@@ -35,19 +35,24 @@ type testCase struct {
3535
3636// "E" means encrypted.
3737var walkTestCases = []testCase {
38- {`{"a": "b"}` , `{"a": "E"}` }, // encryption
39- {`{"a" : "b"}` , `{"a" : "E"}` }, // weird spacing
40- {` { "a" :"b" } ` , ` { "a" :"E" } ` }, // trailing spaces
41- {`{"a": "b"}` + "\n " , `{"a": "E"}` + "\n " }, // trailing newline
42- {`{"_a": "b"}` , `{"_a": "b"}` }, // commenting
43- {`{"a": "b", "c": "d"}` , `{"a": "E", "c": "E"}` }, // order-dependence
44- {`{"a": 1}` , `{"a": 1}` }, // numbers
45- {`{"a": true}` , `{"a": true}` }, // booleans
46- {`{"a": ["b", "c"]}` , `{"a": ["E", "E"]}` }, // encrypting arrays
47- {`{"_a": ["b", "c"]}` , `{"_a": ["b", "c"]}` }, // commenting arrays
48- {`{"a": {"b": "c"}}` , `{"a": {"b": "E"}}` }, // nesting
49- {`{"a": {"_b": "c"}}` , `{"a": {"_b": "c"}}` }, // nested comment
50- {`{"_a": {"b": "c"}}` , `{"_a": {"b": "E"}}` }, // comments don't inherit
38+ {`{"a": "b"}` , `{"a": "E"}` }, // encryption
39+ {`{"a" : "b"}` , `{"a" : "E"}` }, // weird spacing
40+ {` { "a" :"b" } ` , ` { "a" :"E" } ` }, // trailing spaces
41+ {`{"a": "b"}` + "\n " , `{"a": "E"}` + "\n " }, // trailing newline
42+ {`{"_a": "b"}` , `{"_a": "b"}` }, // commenting
43+ {`{"a": "b", "c": "d"}` , `{"a": "E", "c": "E"}` }, // order-dependence
44+ {`{"a": 1}` , `{"a": 1}` }, // numbers
45+ {`{"a": true}` , `{"a": true}` }, // booleans
46+ {`{"a": ["b", "c"]}` , `{"a": ["E", "E"]}` }, // encrypting arrays
47+ {`{"_a": ["b", "c"]}` , `{"_a": ["b", "c"]}` }, // commenting arrays
48+ {`{"a": {"b": "c"}}` , `{"a": {"b": "E"}}` }, // nesting
49+ {`{"a": {"_b": "c"}}` , `{"a": {"_b": "c"}}` }, // nested comment
50+ {`{"a": [{"_b": "c"}, "d"]}` , `{"a": [{"_b": "c"}, "E"]}` }, // nested comment does not leak to a sibling
51+ {`{"a": [{"_b": "c"}, ["d"]]}` , `{"a": [{"_b": "c"}, ["E"]]}` }, // nested comment does not leak to a sibling array
52+ {`{"a": [{"_b": {}}, "d"]}` , `{"a": [{"_b": {}}, "E"]}` }, // empty nested object restores the enclosing state
53+ {`{"_a": [{"_b": "c"}, "d"]}` , `{"_a": [{"_b": "c"}, "d"]}` }, // enclosing array comment persists through a nested object
54+ {`{"_a": [{}, "d"]}` , `{"_a": [{}, "d"]}` }, // enclosing array comment persists through an empty object
55+ {`{"_a": {"b": "c"}}` , `{"_a": {"b": "E"}}` }, // comments don't inherit
5156}
5257
5358func TestQuoteBytes (t * testing.T ) {
0 commit comments