diff options
author | Sergei Skorobogatov <skorobo@rambler.ru> | 2010-02-22 14:32:40 -0800 |
---|---|---|
committer | Sergei Skorobogatov <skorobo@rambler.ru> | 2010-02-22 14:32:40 -0800 |
commit | c8a63ea5052d5e79d6144108f467bd6c4f613ea0 (patch) | |
tree | 338d886aeed248310b81ee2ab2e487ed48e8bb7e /src/pkg/json/struct_test.go | |
parent | 8ae7258d8fa55e8565884d3ff89ee0ef85210786 (diff) | |
download | golang-c8a63ea5052d5e79d6144108f467bd6c4f613ea0.tar.gz |
json: fix quoted strings in Marshal
R=rsc
CC=golang-dev
http://codereview.appspot.com/217047
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/json/struct_test.go')
-rw-r--r-- | src/pkg/json/struct_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/pkg/json/struct_test.go b/src/pkg/json/struct_test.go index f1440c413..66d6e79c2 100644 --- a/src/pkg/json/struct_test.go +++ b/src/pkg/json/struct_test.go @@ -181,6 +181,18 @@ type OneField struct { a int } +type ScalarWithString int + +const ( + AA ScalarWithString = iota + BB + CC +) + +var scalarStrings = []string{"AA", "BB", "CC"} + +func (x ScalarWithString) String() string { return scalarStrings[x] } + var marshalTests = []marshalTest{ // basic string marshalTest{nil, "null"}, @@ -210,6 +222,17 @@ var marshalTests = []marshalTest{ marshalTest{map[string]*MTE{"hi": nil}, `{"hi":null}`}, marshalTest{map[string]interface{}{"hi": 3}, `{"hi":3}`}, marshalTest{&OneField{3}, `{"a":3}`}, + marshalTest{"\x05\x06", `"\u0005\u0006"`}, + marshalTest{uintptr(50000), "50000"}, + marshalTest{uint64(50000), "50000"}, + marshalTest{uint32(50000), "50000"}, + marshalTest{uint16(50000), "50000"}, + marshalTest{uint8(50), "50"}, + marshalTest{int64(50000), "50000"}, + marshalTest{int32(50000), "50000"}, + marshalTest{int16(10000), "10000"}, + marshalTest{int8(50), "50"}, + marshalTest{BB, "1"}, } func TestMarshal(t *testing.T) { |