Espruino/tests/test_integer_literals.js
Marius Gundersen af55d57840 Basic support for numeric separator
This is an initial working version, but it has some known bugs:
* parseInt("1_0") returns 10, not 1. That's a breaking change
* multiple separators in a row is supported, but that's not supported according to the spec
2022-05-24 11:17:25 +02:00

21 lines
250 B
JavaScript

var tests=0, testpass=0;
function t(x) {
console.log(x);
tests++;
if (x) testpass++;
}
t( 0x01 === 1);
t( 0X01 === 1);
t( 0b01 === 1);
t( 0B01 === 1);
t( 0o01 === 1);
t( 0O01 === 1);
t( 1_0 === 10);
t( 0x0_1 === 1);
result = tests==testpass;