Skip to content

Commit

Permalink
fix: handling of control characters
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Jan 16, 2022
1 parent 298cc62 commit c048666
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions dec_skip_cases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
)

var testStrings = []string{
var testStrings = append([]string{
`""`, // valid
`"hello"`, // valid
`"`, // invalid
Expand Down Expand Up @@ -58,7 +58,13 @@ var testStrings = []string{
"\"\\ueeee\"", // valid
"\"\\uFFFF\"", // valid
`"ab\n` + "\x00" + `"`, // invalid
}
}, func() (r []string) {
// Generate tests for invalid space sequences.
for i := byte(0); i <= ' '; i++ {
r = append(r, `"`+string(i)+`"`)
}
return r
}()...)

var testObjs = []string{
"", // invalid
Expand Down
2 changes: 1 addition & 1 deletion w_str.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ var safeSet = [256]byte{
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
'"': 1,
'\\': 1,
}
Expand Down

0 comments on commit c048666

Please sign in to comment.