From 7f82bd347ff745963d0379709ff88e5ff04db778 Mon Sep 17 00:00:00 2001 From: Aleksandr Petrukhin Date: Mon, 18 Jul 2016 16:21:03 +0300 Subject: [PATCH] Added test-case for slice marshalling --- tests/basic_test.go | 5 +++-- tests/data.go | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/basic_test.go b/tests/basic_test.go index 8525240..d2eac28 100644 --- a/tests/basic_test.go +++ b/tests/basic_test.go @@ -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 `}, {`"Username\ufffd"`, "Username\xc5"}, @@ -129,4 +130,4 @@ func TestSpecialCases(t *testing.T) { t.Errorf("[%d] Encoded() = %+v; want %+v", i, got, test.EncodedString) } } -} \ No newline at end of file +} diff --git a/tests/data.go b/tests/data.go index 6fb2a16..faa3093 100644 --- a/tests/data.go +++ b/tests/data.go @@ -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"`