Skip to content

Commit

Permalink
Add test cases for bare number literals, including hex.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkantor authored and jordanbtucker committed Apr 4, 2020
1 parent 1e97d03 commit 661c418
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/parse.js
Expand Up @@ -178,6 +178,30 @@ t.test('parse(text)', t => {
'parses signed NaN'
)

t.strictSame(
JSON5.parse('1'),
1,
'parses 1'
)

t.strictSame(
JSON5.parse('+1.23e100'),
1.23e100,
'parses +1.23e100'
)

t.strictSame(
JSON5.parse('0x1'),
0x1,
'parses bare hexadecimal number'
)

t.strictSame(
JSON5.parse('-0x0123456789abcdefABCDEF'),
-0x0123456789abcdefABCDEF,
'parses bare long hexadecimal number'
)

t.end()
})

Expand Down

0 comments on commit 661c418

Please sign in to comment.