Fix camel case JSON tags
This commit is contained in:
parent
fe62e81152
commit
b0a52de4ea
2 changed files with 9 additions and 4 deletions
|
|
@ -30,7 +30,7 @@ func TestGenerateGoDataClassJSONNamingOverride(t *testing.T) {
|
|||
package demo
|
||||
|
||||
@jsonNaming(camelCase)
|
||||
data class Account(var availableBalance: Double)
|
||||
data class Account(var availableBalance: Double, var Type: String)
|
||||
`)
|
||||
if err != nil {
|
||||
t.Fatalf("parse failed: %v", err)
|
||||
|
|
@ -39,8 +39,10 @@ data class Account(var availableBalance: Double)
|
|||
if err != nil {
|
||||
t.Fatalf("generation failed: %v", err)
|
||||
}
|
||||
if !strings.Contains(string(out), "`json:\"availableBalance\"`") {
|
||||
t.Fatalf("generated Go missing camelCase tag:\n%s", out)
|
||||
for _, want := range []string{"`json:\"availableBalance\"`", "`json:\"type\"`"} {
|
||||
if !strings.Contains(string(out), want) {
|
||||
t.Fatalf("generated Go missing camelCase tag %q:\n%s", want, out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue