Fix ToNumber operations

This commit is contained in:
Leo Balter 2018-01-30 17:43:30 -05:00 committed by Rick Waldron
parent 12797840ae
commit 6d5a7adf4e
46 changed files with 279 additions and 187 deletions

View File

@ -13,7 +13,7 @@ description: >
try
{
var __obj = {valueOf:function(){return new Object;},toString: function() {return new Object();}}
var __obj = {valueOf:function(){return new Object;},toString: function() {return new Object();}}
Number(__obj);
$ERROR('#1.1: var __obj = {valueOf:function(){return new Object;},toNumber: function() {return new Object();}}; Number(__obj) throw TypeError. Actual: ' + (Number(__obj)));
}
@ -21,5 +21,5 @@ catch(e)
{
if ((e instanceof TypeError) !== true) {
$ERROR('#1.2: var __obj = {valueOf:function(){return new Object;},toNumber: function() {return new Object();}}; Number(__obj) throw TypeError. Actual: ' + (e));
}
}
}

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0b` | `0B` BinaryDigit NumericLiteralSeparator BinaryDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0b` | `0B` BinaryDigit NumericLiteralSeparator BinaryDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
BinaryDigit :: one of
0 1
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0b0_1"), 0b01);
assert.sameValue(Number("0B0_1"), 0B01);
assert.sameValue(Number("0b0_1"), NaN, "0b0_1");
assert.sameValue(Number("0B0_1"), NaN, "0B0_1");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0b` | `0B` BinaryDigit NumericLiteralSeparator BinaryDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0b` | `0B` BinaryDigit NumericLiteralSeparator BinaryDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
BinaryDigit :: one of
0 1
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0b0_10"), 0b010);
assert.sameValue(Number("0B0_10"), 0B010);
assert.sameValue(Number("0b0_10"), NaN, "0b0_10");
assert.sameValue(Number("0B0_10"), NaN, "0B0_10");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0b` | `0B` BinaryDigits NumericLiteralSeparator BinaryDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0b` | `0B` BinaryDigits NumericLiteralSeparator BinaryDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
BinaryDigit :: one of
0 1
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0b01_0"), 0b010);
assert.sameValue(Number("0B01_0"), 0B010);
assert.sameValue(Number("0b01_0"), NaN, "0b01_0");
assert.sameValue(Number("0B01_0"), NaN, "0B01_0");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0b` | `0B` BinaryDigits NumericLiteralSeparator BinaryDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0b` | `0B` BinaryDigits NumericLiteralSeparator BinaryDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
BinaryDigit :: one of
0 1
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0b01_00"), 0b0100);
assert.sameValue(Number("0B01_00"), 0B0100);
assert.sameValue(Number("0b01_00"), NaN, "0b01_00");
assert.sameValue(Number("0B01_00"), NaN, "0B01_00");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
DecimalDigits `.` DecimalDigits ExponentPart_opt `-` DecimalDigits
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
DecimalDigits `.` DecimalDigits ExponentPart_opt `-` DecimalDigits
NumericLiteralSeparator ::
_
@ -21,6 +22,7 @@ info: |
- DecimalDigits
...
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1.0e-1_0"), 1.0e-10);
assert.sameValue(Number("1.0e-1_0"), NaN, "1.0e-1_0");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
DecimalDigits `.` DecimalDigits ExponentPart_opt `-` DecimalDigits
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
DecimalDigits `.` DecimalDigits ExponentPart_opt `-` DecimalDigits
NumericLiteralSeparator ::
_
@ -21,6 +22,7 @@ info: |
- DecimalDigits
...
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1.0e-10_0"), 1.0e-100);
assert.sameValue(Number("1.0e-10_0"), NaN, "1.0e-10_0");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
DecimalDigits `.` DecimalDigits ExponentPart_opt `+` DecimalDigits
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
DecimalDigits `.` DecimalDigits ExponentPart_opt `+` DecimalDigits
NumericLiteralSeparator ::
_
@ -21,6 +22,7 @@ info: |
+ DecimalDigits
...
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1.0e+1_0"), 1.0e+10);
assert.sameValue(Number("1.0e+1_0"), NaN, "1.0e+1_0");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
DecimalDigits `.` DecimalDigits ExponentPart_opt `+` DecimalDigits
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
DecimalDigits `.` DecimalDigits ExponentPart_opt `+` DecimalDigits
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
+ DecimalDigits
...
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1.0e+10_0"), 1.0e+100);
assert.sameValue(Number("1.0e+10_0"), NaN, "1.0e+10_0");

View File

@ -3,8 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: NonZeroDigit NumericLiteralSeparator DecimalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
NonZeroDigit NumericLiteralSeparator DecimalDigits
NumericLiteralSeparator ::
_
@ -20,15 +22,16 @@ info: |
DecimalDigit :: one of
0 1 2 3 4 5 6 7 8 9
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1_0"), 10);
assert.sameValue(Number("1_1"), 11);
assert.sameValue(Number("1_2"), 12);
assert.sameValue(Number("1_3"), 13);
assert.sameValue(Number("1_4"), 14);
assert.sameValue(Number("1_5"), 15);
assert.sameValue(Number("1_6"), 16);
assert.sameValue(Number("1_7"), 17);
assert.sameValue(Number("1_8"), 18);
assert.sameValue(Number("1_9"), 19);
assert.sameValue(Number("1_0"), NaN, "1_0");
assert.sameValue(Number("1_1"), NaN, "1_1");
assert.sameValue(Number("1_2"), NaN, "1_2");
assert.sameValue(Number("1_3"), NaN, "1_3");
assert.sameValue(Number("1_4"), NaN, "1_4");
assert.sameValue(Number("1_5"), NaN, "1_5");
assert.sameValue(Number("1_6"), NaN, "1_6");
assert.sameValue(Number("1_7"), NaN, "1_7");
assert.sameValue(Number("1_8"), NaN, "1_8");
assert.sameValue(Number("1_9"), NaN, "1_9");

View File

@ -3,10 +3,11 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
DecimalDigits `.` DecimalDigits NumericLiteralSeparator DecimalDigits
ExponentPart SignedInteger
info: |
NumericLiteralSeparator ::
_
@ -20,6 +21,7 @@ info: |
ExponentIndicator :: one of
e E
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("10.00_01e2"), 10.0001e2);
assert.sameValue(Number("10.00_01e2"), NaN, "10.00_01e2");

View File

@ -4,7 +4,7 @@
/*---
esid: prod-NumericLiteralSeparator
description: DecimalDigits NumericLiteralSeparator DecimalDigit
info: |
info:
NumericLiteralSeparator ::
_
@ -12,15 +12,16 @@ info: |
...
DecimalDigits NumericLiteralSeparator DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("123456789_0"), 1234567890);
assert.sameValue(Number("123456789_1"), 1234567891);
assert.sameValue(Number("123456789_2"), 1234567892);
assert.sameValue(Number("123456789_3"), 1234567893);
assert.sameValue(Number("123456789_4"), 1234567894);
assert.sameValue(Number("123456789_5"), 1234567895);
assert.sameValue(Number("123456789_6"), 1234567896);
assert.sameValue(Number("123456789_7"), 1234567897);
assert.sameValue(Number("123456789_8"), 1234567898);
assert.sameValue(Number("123456789_9"), 1234567899);
assert.sameValue(Number("123456789_0"), NaN, "123456789_0");
assert.sameValue(Number("123456789_1"), NaN, "123456789_1");
assert.sameValue(Number("123456789_2"), NaN, "123456789_2");
assert.sameValue(Number("123456789_3"), NaN, "123456789_3");
assert.sameValue(Number("123456789_4"), NaN, "123456789_4");
assert.sameValue(Number("123456789_5"), NaN, "123456789_5");
assert.sameValue(Number("123456789_6"), NaN, "123456789_6");
assert.sameValue(Number("123456789_7"), NaN, "123456789_7");
assert.sameValue(Number("123456789_8"), NaN, "123456789_8");
assert.sameValue(Number("123456789_9"), NaN, "123456789_9");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`.` DecimalDigit NumericLiteralSeparator DecimalDigit ExponentPart
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`.` DecimalDigit NumericLiteralSeparator DecimalDigit ExponentPart
NumericLiteralSeparator ::
_
@ -20,6 +21,7 @@ info: |
ExponentIndicator :: one of
e E
features: [numeric-separator-literal]
---*/
assert.sameValue(Number(".0_1e2"), .01e2);
assert.sameValue(Number(".0_1e2"), NaN, ".0_1e2");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`.` DecimalDigit NumericLiteralSeparator DecimalDigits ExponentPart
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`.` DecimalDigit NumericLiteralSeparator DecimalDigits ExponentPart
NumericLiteralSeparator ::
_
@ -20,6 +21,7 @@ info: |
ExponentIndicator :: one of
e E
features: [numeric-separator-literal]
---*/
assert.sameValue(Number(".1_01e2"), .101e2);
assert.sameValue(Number(".1_01e2"), NaN, ".1_01e2");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`.` DecimalDigits NumericLiteralSeparator DecimalDigit ExponentPart
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`.` DecimalDigits NumericLiteralSeparator DecimalDigit ExponentPart
NumericLiteralSeparator ::
_
@ -20,6 +21,7 @@ info: |
ExponentIndicator :: one of
e E
features: [numeric-separator-literal]
---*/
assert.sameValue(Number(".10_1e2"), .101e2);
assert.sameValue(Number(".10_1e2"), NaN, ".10_1e2");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`.` DecimalDigits NumericLiteralSeparator DecimalDigits ExponentPart
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`.` DecimalDigits NumericLiteralSeparator DecimalDigits ExponentPart
NumericLiteralSeparator ::
_
@ -20,6 +21,7 @@ info: |
ExponentIndicator :: one of
e E
features: [numeric-separator-literal]
---*/
assert.sameValue(Number(".00_01e2"), .0001e2);
assert.sameValue(Number(".00_01e2"), NaN, ".00_01e2");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0x` | `0X` HexDigit NumericLiteralSeparator HexDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0x` | `0X` HexDigit NumericLiteralSeparator HexDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
HexDigit::one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0x0_1"), 0x01);
assert.sameValue(Number("0X0_1"), 0X01);
assert.sameValue(Number("0x0_1"), NaN, "0x0_1");
assert.sameValue(Number("0X0_1"), NaN, "0X0_1");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0x` | `0X` HexDigit NumericLiteralSeparator HexDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0x` | `0X` HexDigit NumericLiteralSeparator HexDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
HexDigit::one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0x0_10"), 0x010);
assert.sameValue(Number("0X0_10"), 0X010);
assert.sameValue(Number("0x0_10"), NaN, "0x0_10");
assert.sameValue(Number("0X0_10"), NaN, "0X0_10");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0x` | `0X` HexDigits NumericLiteralSeparator HexDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0x` | `0X` HexDigits NumericLiteralSeparator HexDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
HexDigit::one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0x01_0"), 0x010);
assert.sameValue(Number("0X01_0"), 0X010);
assert.sameValue(Number("0x01_0"), NaN, "0x01_0");
assert.sameValue(Number("0X01_0"), NaN, "0X01_0");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0x` | `0X` HexDigits NumericLiteralSeparator HexDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0x` | `0X` HexDigits NumericLiteralSeparator HexDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
HexDigit::one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0x01_00"), 0x0100);
assert.sameValue(Number("0X01_00"), 0X0100);
assert.sameValue(Number("0x01_00"), NaN, "0x01_00");
assert.sameValue(Number("0X01_00"), NaN, "0X01_00");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0x` | `0X` HexDigit NumericLiteralSeparator HexDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0x` | `0X` HexDigit NumericLiteralSeparator HexDigit
NumericLiteralSeparator ::
_
@ -21,27 +22,28 @@ info: |
HexDigit::one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0x0_0"), 0x00);
assert.sameValue(Number("0x1_1"), 0x11);
assert.sameValue(Number("0x2_2"), 0x22);
assert.sameValue(Number("0x3_3"), 0x33);
assert.sameValue(Number("0x4_4"), 0x44);
assert.sameValue(Number("0x5_5"), 0x55);
assert.sameValue(Number("0x6_6"), 0x66);
assert.sameValue(Number("0x7_7"), 0x77);
assert.sameValue(Number("0x8_8"), 0x88);
assert.sameValue(Number("0x9_9"), 0x99);
assert.sameValue(Number("0xa_a"), 0xaa);
assert.sameValue(Number("0xb_b"), 0xbb);
assert.sameValue(Number("0xc_c"), 0xcc);
assert.sameValue(Number("0xd_d"), 0xdd);
assert.sameValue(Number("0xe_e"), 0xee);
assert.sameValue(Number("0xf_f"), 0xff);
assert.sameValue(Number("0xA_A"), 0xAA);
assert.sameValue(Number("0xB_B"), 0xBB);
assert.sameValue(Number("0xC_C"), 0xCC);
assert.sameValue(Number("0xD_D"), 0xDD);
assert.sameValue(Number("0xE_E"), 0xEE);
assert.sameValue(Number("0xF_F"), 0xFF);
assert.sameValue(Number("0x0_0"), NaN, "0x0_0");
assert.sameValue(Number("0x1_1"), NaN, "0x1_1");
assert.sameValue(Number("0x2_2"), NaN, "0x2_2");
assert.sameValue(Number("0x3_3"), NaN, "0x3_3");
assert.sameValue(Number("0x4_4"), NaN, "0x4_4");
assert.sameValue(Number("0x5_5"), NaN, "0x5_5");
assert.sameValue(Number("0x6_6"), NaN, "0x6_6");
assert.sameValue(Number("0x7_7"), NaN, "0x7_7");
assert.sameValue(Number("0x8_8"), NaN, "0x8_8");
assert.sameValue(Number("0x9_9"), NaN, "0x9_9");
assert.sameValue(Number("0xa_a"), NaN, "0xa_a");
assert.sameValue(Number("0xb_b"), NaN, "0xb_b");
assert.sameValue(Number("0xc_c"), NaN, "0xc_c");
assert.sameValue(Number("0xd_d"), NaN, "0xd_d");
assert.sameValue(Number("0xe_e"), NaN, "0xe_e");
assert.sameValue(Number("0xf_f"), NaN, "0xf_f");
assert.sameValue(Number("0xA_A"), NaN, "0xA_A");
assert.sameValue(Number("0xB_B"), NaN, "0xB_B");
assert.sameValue(Number("0xC_C"), NaN, "0xC_C");
assert.sameValue(Number("0xD_D"), NaN, "0xD_D");
assert.sameValue(Number("0xE_E"), NaN, "0xE_E");
assert.sameValue(Number("0xF_F"), NaN, "0xF_F");

View File

@ -3,8 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: NonZeroDigit NumericLiteralSeparator DecimalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
NonZeroDigit NumericLiteralSeparator DecimalDigits
NumericLiteralSeparator ::
_
@ -22,17 +24,18 @@ info: |
DecimalDigit :: one of
0 1 2 3 4 5 6 7 8 9
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1_0"), 10);
assert.sameValue(Number("1_1"), 11);
assert.sameValue(Number("2_2"), 22);
assert.sameValue(Number("3_3"), 33);
assert.sameValue(Number("4_4"), 44);
assert.sameValue(Number("5_5"), 55);
assert.sameValue(Number("6_6"), 66);
assert.sameValue(Number("7_7"), 77);
assert.sameValue(Number("8_8"), 88);
assert.sameValue(Number("9_9"), 99);
assert.sameValue(Number("1_0"), NaN, "1_0");
assert.sameValue(Number("1_1"), NaN, "1_1");
assert.sameValue(Number("2_2"), NaN, "2_2");
assert.sameValue(Number("3_3"), NaN, "3_3");
assert.sameValue(Number("4_4"), NaN, "4_4");
assert.sameValue(Number("5_5"), NaN, "5_5");
assert.sameValue(Number("6_6"), NaN, "6_6");
assert.sameValue(Number("7_7"), NaN, "7_7");
assert.sameValue(Number("8_8"), NaN, "8_8");
assert.sameValue(Number("9_9"), NaN, "9_9");

View File

@ -3,8 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: NonZeroDigit NumericLiteralSeparator DecimalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
NonZeroDigit NumericLiteralSeparator DecimalDigits
NumericLiteralSeparator ::
_
@ -20,6 +22,7 @@ info: |
DecimalDigits DecimalDigit
...
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1_1"), 11);
assert.sameValue(Number("1_1"), NaN, "1_1");

View File

@ -3,8 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: NonZeroDigit NumericLiteralSeparator DecimalDigits
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
NonZeroDigit NumericLiteralSeparator DecimalDigits
NumericLiteralSeparator ::
_
@ -20,6 +22,7 @@ info: |
DecimalDigits DecimalDigit
...
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1_0123456789"), 10123456789);
assert.sameValue(Number("1_0123456789"), NaN, "1_0123456789");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit
NumericLiteralSeparator ::
_
@ -21,13 +22,14 @@ info: |
OctalDigit :: one of
0 1 2 3 4 5 6 7
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0o0_0"), 0o00);
assert.sameValue(Number("0o1_1"), 0o11);
assert.sameValue(Number("0o2_2"), 0o22);
assert.sameValue(Number("0o3_3"), 0o33);
assert.sameValue(Number("0o4_4"), 0o44);
assert.sameValue(Number("0o5_5"), 0o55);
assert.sameValue(Number("0o6_6"), 0o66);
assert.sameValue(Number("0o7_7"), 0o77);
assert.sameValue(Number("0o0_0"), NaN, "0o0_0");
assert.sameValue(Number("0o1_1"), NaN, "0o1_1");
assert.sameValue(Number("0o2_2"), NaN, "0o2_2");
assert.sameValue(Number("0o3_3"), NaN, "0o3_3");
assert.sameValue(Number("0o4_4"), NaN, "0o4_4");
assert.sameValue(Number("0o5_5"), NaN, "0o5_5");
assert.sameValue(Number("0o6_6"), NaN, "0o6_6");
assert.sameValue(Number("0o7_7"), NaN, "0o7_7");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
OctalDigit :: one of
0 1 2 3 4 5 6 7
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0o0_1"), 0o01);
assert.sameValue(Number("0O0_1"), 0O01);
assert.sameValue(Number("0o0_1"), NaN, "0o0_1");
assert.sameValue(Number("0O0_1"), NaN, "0O0_1");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
OctalDigit :: one of
0 1 2 3 4 5 6 7
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0o0_10"), 0o010);
assert.sameValue(Number("0O0_10"), 0O010);
assert.sameValue(Number("0o0_10"), NaN, "0o0_10");
assert.sameValue(Number("0O0_10"), NaN, "0O0_10");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0o` | `0O` OctalDigits NumericLiteralSeparator OctalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0o` | `0O` OctalDigits NumericLiteralSeparator OctalDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
OctalDigit :: one of
0 1 2 3 4 5 6 7
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0o01_0"), 0o010);
assert.sameValue(Number("0O01_0"), 0O010);
assert.sameValue(Number("0o01_0"), NaN, "0o01_0");
assert.sameValue(Number("0O01_0"), NaN, "0O01_0");

View File

@ -3,9 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: >
`0o` | `0O` OctalDigits NumericLiteralSeparator OctalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
`0o` | `0O` OctalDigits NumericLiteralSeparator OctalDigit
NumericLiteralSeparator ::
_
@ -21,7 +22,8 @@ info: |
OctalDigit :: one of
0 1 2 3 4 5 6 7
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("0o01_00"), 0o0100);
assert.sameValue(Number("0O01_00"), 0O0100);
assert.sameValue(Number("0o01_00"), NaN, "0o01_00");
assert.sameValue(Number("0O01_00"), NaN, "0O01_00");

View File

@ -3,8 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: DecimalDigits NumericLiteralSeparator DecimalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
DecimalDigits NumericLiteralSeparator DecimalDigit
NumericLiteralSeparator ::
_
@ -12,15 +14,16 @@ info: |
...
- DecimalDigits
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("-123456789_0"), -1234567890);
assert.sameValue(Number("-123456789_1"), -1234567891);
assert.sameValue(Number("-123456789_2"), -1234567892);
assert.sameValue(Number("-123456789_3"), -1234567893);
assert.sameValue(Number("-123456789_4"), -1234567894);
assert.sameValue(Number("-123456789_5"), -1234567895);
assert.sameValue(Number("-123456789_6"), -1234567896);
assert.sameValue(Number("-123456789_7"), -1234567897);
assert.sameValue(Number("-123456789_8"), -1234567898);
assert.sameValue(Number("-123456789_9"), -1234567899);
assert.sameValue(Number("-123456789_0"), NaN, "-123456789_0");
assert.sameValue(Number("-123456789_1"), NaN, "-123456789_1");
assert.sameValue(Number("-123456789_2"), NaN, "-123456789_2");
assert.sameValue(Number("-123456789_3"), NaN, "-123456789_3");
assert.sameValue(Number("-123456789_4"), NaN, "-123456789_4");
assert.sameValue(Number("-123456789_5"), NaN, "-123456789_5");
assert.sameValue(Number("-123456789_6"), NaN, "-123456789_6");
assert.sameValue(Number("-123456789_7"), NaN, "-123456789_7");
assert.sameValue(Number("-123456789_8"), NaN, "-123456789_8");
assert.sameValue(Number("-123456789_9"), NaN, "-123456789_9");

View File

@ -3,8 +3,10 @@
/*---
esid: prod-NumericLiteralSeparator
description: DecimalDigits NumericLiteralSeparator DecimalDigit
description: NumericLiteralSeparator is not valid on string conversions for ToNumber operations
info: |
DecimalDigits NumericLiteralSeparator DecimalDigit
NumericLiteralSeparator ::
_
@ -12,16 +14,16 @@ info: |
...
+ DecimalDigits
...
features: [numeric-separator-literal]
---*/
assert.sameValue(Number("+123456789_0"), 1234567890);
assert.sameValue(Number("+123456789_1"), 1234567891);
assert.sameValue(Number("+123456789_2"), 1234567892);
assert.sameValue(Number("+123456789_3"), 1234567893);
assert.sameValue(Number("+123456789_4"), 1234567894);
assert.sameValue(Number("+123456789_5"), 1234567895);
assert.sameValue(Number("+123456789_6"), 1234567896);
assert.sameValue(Number("+123456789_7"), 1234567897);
assert.sameValue(Number("+123456789_8"), 1234567898);
assert.sameValue(Number("+123456789_9"), 1234567899);
assert.sameValue(Number("+123456789_0"), NaN, "+123456789_0");
assert.sameValue(Number("+123456789_1"), NaN, "+123456789_1");
assert.sameValue(Number("+123456789_2"), NaN, "+123456789_2");
assert.sameValue(Number("+123456789_3"), NaN, "+123456789_3");
assert.sameValue(Number("+123456789_4"), NaN, "+123456789_4");
assert.sameValue(Number("+123456789_5"), NaN, "+123456789_5");
assert.sameValue(Number("+123456789_6"), NaN, "+123456789_6");
assert.sameValue(Number("+123456789_7"), NaN, "+123456789_7");
assert.sameValue(Number("+123456789_8"), NaN, "+123456789_8");
assert.sameValue(Number("+123456789_9"), NaN, "+123456789_9");

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrDecimalDigits . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -14,6 +15,7 @@ info: |
StrDecimalDigits NumericLiteralSeparator DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1.0e-1_0"), 1.0e-1);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrDecimalDigits . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -14,6 +15,7 @@ info: |
StrDecimalDigits NumericLiteralSeparator DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1.0e-10_0"), 1.0e-10);

View File

@ -4,7 +4,7 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: >
StrDecimalDigits . StrDecimalDigits StrExponentPart
The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -15,6 +15,7 @@ info: |
StrDecimalDigits NumericLiteralSeparator DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1.0e+1_0"), 1.0e+1);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrDecimalDigits . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -14,6 +15,7 @@ info: |
StrDecimalDigits NumericLiteralSeparator DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1.0e+10_0"), 1.0e+10);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrUnsignedDecimalLiteral
description: >
The NSL does not affect strings parsed by parseFloat - StrUnsignedDecimalLiteral
info: |
StrStrUnsignedDecimalLiteral :::
@ -17,6 +18,7 @@ info: |
DecimalDigit ::: one of
0 1 2 3 4 5 6 7 8 9
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1_0"), 1);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrDecimalDigits . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - StrDecimalDigits . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -13,6 +14,7 @@ info: |
DecimalDigit
StrDecimalDigits DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("10.00_01e2"), 10.00);

View File

@ -3,13 +3,15 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrDecimalDigits
description: >
The NSL does not affect strings parsed by parseFloat - StrDecimalDigits
info: |
StrDecimalDigits :::
DecimalDigit
StrDecimalDigits DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("123456789_0"), 123456789);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -14,6 +15,7 @@ info: |
...
StrDecimalDigits DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat(".0_1e2"), .0);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -14,6 +15,7 @@ info: |
...
StrDecimalDigits DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat(".1_01e2"), .1);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -13,6 +14,7 @@ info: |
DecimalDigit
StrDecimalDigits DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat(".10_1e2"), .10);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: . StrDecimalDigits StrExponentPart
description: >
The NSL does not affect strings parsed by parseFloat - . StrDecimalDigits StrExponentPart
info: |
StrUnsignedDecimalLiteral :::
@ -13,6 +14,7 @@ info: |
DecimalDigit
StrDecimalDigits DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat(".00_01e2"), .00);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: NonZeroDigit NumericLiteralSeparator DecimalDigit
description: >
The NSL does not affect strings parsed by parseFloat - NonZeroDigit NumericLiteralSeparator DecimalDigit
info: |
StrUnsignedDecimalLiteral :::
@ -19,6 +20,7 @@ info: |
DecimalDigit ::: one of
0 1 2 3 4 5 6 7 8 9
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1_0"), 1);

View File

@ -3,7 +3,8 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrDecimalDigits
description: >
The NSL does not affect strings parsed by parseFloat - StrDecimalDigits
info: |
StrDecimalDigits :::
@ -11,6 +12,7 @@ info: |
StrDecimalDigits DecimalDigit
...
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1_1"), 1);

View File

@ -3,13 +3,15 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: DecimalDigit
description: >
The NSL does not affect strings parsed by parseFloat - DecimalDigit
info: |
StrDecimalDigits :::
DecimalDigit
StrDecimalDigits DecimalDigit
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("1_0123456789"), 1);

View File

@ -3,14 +3,15 @@
/*---
esid: sec-tonumber-applied-to-the-string-type
description: StrUnsignedDecimalLiteral
description: >
The NSL does not affect strings parsed by parseFloat (StrUnsignedDecimalLiteral)
info: |
StrDecimalLiteral :::
StrUnsignedDecimalLiteral
+ StrUnsignedDecimalLiteral
- StrUnsignedDecimalLiteral
features: [numeric-separator-literal]
---*/
assert.sameValue(parseFloat("+123456789_0"), +123456789);