File tree 1 file changed +29
-1
lines changed 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -1578,7 +1578,6 @@ func TestGithubIssue41(t *testing.T) {
1578
1578
"expected: " , expectedString ,
1579
1579
)
1580
1580
}
1581
-
1582
1581
}
1583
1582
1584
1583
func TestGithubIssue44 (t * testing.T ) {
@@ -1602,6 +1601,35 @@ func (r *rawJsonString) UnmarshalJSON(b []byte) error {
1602
1601
return nil
1603
1602
}
1604
1603
1604
+ func TestGithubIssue63 (t * testing.T ) {
1605
+ expectedString := `{"my_field":"test","code":0}`
1606
+
1607
+ type MyStruct struct {
1608
+ MyField string `json:"my_field,omitempty"`
1609
+ }
1610
+
1611
+ type MyStruct2 struct {
1612
+ * MyStruct
1613
+ Code int `json:"code"`
1614
+ }
1615
+
1616
+ input := MyStruct2 {
1617
+ MyStruct : & MyStruct {
1618
+ MyField : "test" ,
1619
+ },
1620
+ Code : 0 ,
1621
+ }
1622
+
1623
+ if b , err := Marshal (input ); err != nil {
1624
+ t .Error (err )
1625
+ } else if string (b ) != expectedString {
1626
+ t .Error (
1627
+ "got: " , string (b ),
1628
+ "expected: " , expectedString ,
1629
+ )
1630
+ }
1631
+ }
1632
+
1605
1633
func TestSetTrustRawMessage (t * testing.T ) {
1606
1634
buf := & bytes.Buffer {}
1607
1635
enc := NewEncoder (buf )
You can’t perform that action at this time.
0 commit comments