Skip to content

Commit 6ac021c

Browse files
committed
Excercised invalid unicode characters in json literal
1 parent ebd2d30 commit 6ac021c

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

tests/literal.json

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@
7878
"expression": "`9`",
7979
"result": 9
8080
},
81-
{
82-
"expression": "`42 `",
83-
"result": 42
84-
},
8581
{
8682
"comment": "Escaping a backtick in quotes",
8783
"expression": "`\"foo\\`bar\"`",
@@ -136,6 +132,41 @@
136132
"comment": "Literal on RHS of subexpr not allowed",
137133
"expression": "foo.`\"bar\"`",
138134
"error": "syntax"
135+
},
136+
{
137+
"comment": "Literal with all valid leading and trailing JSON whitespace",
138+
"expression": "` \t\n\r{\"foo\": true} \t\n\r`",
139+
"result": {"foo": true}
140+
},
141+
{
142+
"comment": "Literal with non-JSON whitespace U+000C FORM FEED",
143+
"expression": "`0\f`",
144+
"error": "syntax"
145+
},
146+
{
147+
"comment": "Literal with non-JSON whitespace U+0085 NEXT LINE",
148+
"expression": "`0\u0085`",
149+
"error": "syntax"
150+
},
151+
{
152+
"comment": "Literal with non-JSON whitespace U+00A0 NO-BREAK SPACE",
153+
"expression": "`0\u00A0`",
154+
"error": "syntax"
155+
},
156+
{
157+
"comment": "Literal with non-JSON whitespace U+1680 OGHAM SPACE MARK",
158+
"expression": "`0\u1680`",
159+
"error": "syntax"
160+
},
161+
{
162+
"comment": "Literal with non-JSON whitespace U+2028 LINE SEPARATOR",
163+
"expression": "`0\u2028`",
164+
"error": "syntax"
165+
},
166+
{
167+
"comment": "Literal with non-JSON whitespace U+3000 IDEOGRAPHIC SPACE",
168+
"expression": "`0\u3000`",
169+
"error": "syntax"
139170
}
140171
]
141172
},

0 commit comments

Comments
 (0)