Skip to content

Commit

Permalink
test: Add invalid JSON tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romshark committed Jan 16, 2022
1 parent ec1dc2d commit 4e0114f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions jscan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,26 @@ func TestScanError(t *testing.T) {
input: `["okay",]`,
expect: `error at index 8 (']'): unexpected token`,
},
{
name: `missing comma`,
input: `["okay"[`,
expect: `error at index 7 ('['): unexpected token`,
},
{
name: `missing comma`,
input: `["okay"-12`,
expect: `error at index 7 ('-'): unexpected token`,
},
{
name: `missing comma`,
input: `["okay"0`,
expect: `error at index 7 ('0'): unexpected token`,
},
{
name: `missing comma`,
input: `["okay""not okay"]`,
expect: `error at index 7 ('"'): unexpected token`,
},
{
name: `missing comma`,
input: `{"foo":"bar" "baz":"fuz"}`,
Expand Down

0 comments on commit 4e0114f

Please sign in to comment.