Commit f17ad9e3 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[numeric separator] Add tests for parseInt

Bug: v8:7317
Change-Id: I6c88de63c4bdb31f873c18c450d26f60659171f2
Reviewed-on: https://chromium-review.googlesource.com/968621
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52030}
parent 7e7c04b6
......@@ -79,6 +79,24 @@
assertEquals(NaN, dot3);
}
{
assertEquals(1, parseInt('1_2_3'));
assertEquals(0, parseInt('0_1_0_1_0'));
assertEquals(15, parseInt('0xF_F'));
assertEquals(10, parseInt('10e+1_0'));
assertEquals(0, parseInt('0o7_7_7'));
assertEquals(0, parseInt('0b1_0_1_0'));
assertEquals(9, parseInt('9_1.1_3'));
assertEquals(1, parseInt('1.1_3'));
assertEquals(1, parseInt('1_1.21'));
assertEquals(17, parseInt('017_123'));
assertEquals(1, parseInt('1_2_3', 10));
assertEquals(15, parseInt('0xF_F', 16));
assertEquals(7, parseInt('7_7_7', 8));
assertEquals(1, parseInt('1_0_1_0', 2));
}
assertThrows('1_0_0_0_', SyntaxError);
assertThrows('1e_1', SyntaxError);
assertThrows('1e+_1', SyntaxError);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment