diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-08-24 13:23:15 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-08-24 13:23:15 +0200 |
| commit | 0b48c8ae1c27bfcc1f5b3f611e64f47321cd18c6 (patch) | |
| tree | 107ba5c251175c7ce0d07eeb4748967510c548e2 /src/pkg/json/decode_test.go | |
| parent | 825e92f34920934f09dbf4c614dbd2913ba464cb (diff) | |
| download | golang-0b48c8ae1c27bfcc1f5b3f611e64f47321cd18c6.tar.gz | |
Imported Upstream version 2011.08.17
Diffstat (limited to 'src/pkg/json/decode_test.go')
| -rw-r--r-- | src/pkg/json/decode_test.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pkg/json/decode_test.go b/src/pkg/json/decode_test.go index c0ef5bc3a..a855d6048 100644 --- a/src/pkg/json/decode_test.go +++ b/src/pkg/json/decode_test.go @@ -34,10 +34,17 @@ func (u *unmarshaler) UnmarshalJSON(b []byte) os.Error { return nil } +type ustruct struct { + M unmarshaler +} + var ( um0, um1 unmarshaler // target2 of unmarshaling ump = &um1 umtrue = unmarshaler{true} + umslice = []unmarshaler{unmarshaler{true}} + umslicep = new([]unmarshaler) + umstruct = ustruct{unmarshaler{true}} ) type unmarshalTest struct { @@ -77,6 +84,9 @@ var unmarshalTests = []unmarshalTest{ // unmarshal interface test {`{"T":false}`, &um0, umtrue, nil}, // use "false" so test will fail if custom unmarshaler is not called {`{"T":false}`, &ump, &umtrue, nil}, + {`[{"T":false}]`, &umslice, umslice, nil}, + {`[{"T":false}]`, &umslicep, &umslice, nil}, + {`{"M":{"T":false}}`, &umstruct, umstruct, nil}, } func TestMarshal(t *testing.T) { @@ -140,7 +150,6 @@ func TestUnmarshal(t *testing.T) { println(string(data)) data, _ = Marshal(tt.out) println(string(data)) - return continue } } |
