add unit test simplifying the failing case

easyjson is mistakenly naming the type of this field 'tests.MyString' in the generated output
something about a named type inside an anonmymous type is triggering this bug.
This commit is contained in:
Nicolas S. Dade
2017-01-05 17:32:30 -08:00
parent 9d6630dc8c
commit bb584cc9d8
2 changed files with 18 additions and 1 deletions
+3 -1
View File
@@ -21,7 +21,8 @@ generate: root build
.root/src/$(PKG)/tests/snake.go \
.root/src/$(PKG)/tests/data.go \
.root/src/$(PKG)/tests/omitempty.go \
.root/src/$(PKG)/tests/nothing.go
.root/src/$(PKG)/tests/nothing.go \
.root/src/$(PKG)/tests/named_type.go
.root/bin/easyjson -all .root/src/$(PKG)/tests/data.go
.root/bin/easyjson -all .root/src/$(PKG)/tests/nothing.go
@@ -29,6 +30,7 @@ generate: root build
.root/bin/easyjson -omit_empty .root/src/$(PKG)/tests/omitempty.go
.root/bin/easyjson -build_tags=use_easyjson .root/src/$(PKG)/benchmark/data.go
.root/bin/easyjson .root/src/$(PKG)/tests/nested_easy.go
.root/bin/easyjson .root/src/$(PKG)/tests/named_type.go
test: generate root
go test \
+15
View File
@@ -0,0 +1,15 @@
package tests
//easyjson:json
type NamedType struct {
Inner struct {
// easyjson is mistakenly naming the type of this field 'tests.MyString' in the generated output
// something about a named type inside an anonmymous type is triggering this bug
Field MyString
}
}
type MyString string
var namedTypeValue = NamedType{Inner: struct{ Field MyString }{Field: "test"}}
var namedTypeValueString = `{"Inner":{"Field":"test"}}`