Add more ToNumber tests for invalid binary and octal literals

This commit is contained in:
Ivan Vyshnevskyi 2017-12-26 10:51:17 +02:00 committed by Rick Waldron
parent 4f06f98771
commit d540256163
2 changed files with 12 additions and 0 deletions

View File

@ -18,3 +18,9 @@ info: |
assert.sameValue(Number('0b2'), NaN, 'invalid digit');
assert.sameValue(Number('00b0'), NaN, 'leading zero');
assert.sameValue(Number('0b'), NaN, 'omitted digits');
assert.sameValue(Number('+0b1'), NaN, 'plus sign');
assert.sameValue(Number('-0b1'), NaN, 'minus sign');
assert.sameValue(Number('0b1.01'), NaN, 'fractional part');
assert.sameValue(Number('0b1e10'), NaN, 'exponent part');
assert.sameValue(Number('0b1e-10'), NaN, 'exponent part with a minus sign');
assert.sameValue(Number('0b1e+10'), NaN, 'exponent part with a plus sign');

View File

@ -18,3 +18,9 @@ info: |
assert.sameValue(Number('0o8'), NaN, 'invalid digit');
assert.sameValue(Number('00o0'), NaN, 'leading zero');
assert.sameValue(Number('0o'), NaN, 'omitted digits');
assert.sameValue(Number('+0o10'), NaN, 'plus sign');
assert.sameValue(Number('-0o10'), NaN, 'minus sign');
assert.sameValue(Number('0o10.01'), NaN, 'fractional part');
assert.sameValue(Number('0o1e10'), NaN, 'exponent part');
assert.sameValue(Number('0o1e-10'), NaN, 'exponent part with a minus sign');
assert.sameValue(Number('0o1e+10'), NaN, 'exponent part with a plus sign');