summaryrefslogtreecommitdiff
path: root/src/pkg/json/struct_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/json/struct_test.go')
-rw-r--r--src/pkg/json/struct_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pkg/json/struct_test.go b/src/pkg/json/struct_test.go
index caf398b11..c01f4ddeb 100644
--- a/src/pkg/json/struct_test.go
+++ b/src/pkg/json/struct_test.go
@@ -66,6 +66,17 @@ func check(t *testing.T, ok bool, name string, v interface{}) {
}
}
+const whiteSpaceEncoded = " \t{\n\"s\"\r:\"string\"\v}"
+
+func TestUnmarshalWhitespace(t *testing.T) {
+ var m myStruct;
+ ok, errtok := Unmarshal(whiteSpaceEncoded, &m);
+ if !ok {
+ t.Fatalf("Unmarshal failed near %s", errtok)
+ }
+ check(t, m.S == "string", "string", m.S);
+}
+
func TestUnmarshal(t *testing.T) {
var m myStruct;
m.F = true;