Added test-case for slice marshalling

This commit is contained in:
Aleksandr Petrukhin
2016-07-18 16:21:03 +03:00
parent 79b36b0b05
commit 7f82bd347f
2 changed files with 10 additions and 2 deletions
+3 -2
View File
@@ -32,6 +32,7 @@ var testCases = []struct {
{&excludedFieldValue, excludedFieldString},
{&mapsValue, mapsString},
{&deepNestValue, deepNestString},
{&IntsValue, IntsString},
}
func TestMarshal(t *testing.T) {
@@ -107,7 +108,7 @@ func TestParseNull(t *testing.T) {
var testSpecialCases = []struct {
EncodedString string
Value string
Value string
}{
{`"Username \u003cuser@example.com\u003e"`, `Username <user@example.com>`},
{`"Username\ufffd"`, "Username\xc5"},
@@ -129,4 +130,4 @@ func TestSpecialCases(t *testing.T) {
t.Errorf("[%d] Encoded() = %+v; want %+v", i, got, test.EncodedString)
}
}
}
}
+7
View File
@@ -532,6 +532,13 @@ var deepNestString = `{` +
`"NamedStringSlice":["value4","value5"]` +
`}`
//easyjson:json
type Ints []int
var IntsValue = Ints{1, 2, 3, 4, 5}
var IntsString = `[1,2,3,4,5]`
type RequiredOptionalStruct struct {
FirstName string `json:"first_name,required"`
Lastname string `json:"last_name"`