mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
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:
@@ -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 \
|
||||
|
||||
@@ -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"}}`
|
||||
Reference in New Issue
Block a user