Skip to content
Snippets Groups Projects
Commit 12797840 authored by Rick Waldron's avatar Rick Waldron
Browse files

features: [numeric-separator-literal]

parent 53c00784
No related branches found
No related tags found
No related merge requests found
Showing
with 9 additions and 345 deletions
......@@ -68,6 +68,10 @@ string-trimming
String.prototype.trimEnd
String.prototype.trimStart
# Numeric Separator Literal
# https://github.com/tc39/proposal-numeric-separator
numeric-separator-literal
# Standard language features
#
# Language features that have been included in a published version of the
......
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0b StrBinaryDigits, 0B StrBinaryDigits
info: |
StrBinaryIntegerLiteral :::
0b StrBinaryDigits
0B StrBinaryDigits
StrBinaryDigits :::
BinaryDigit
StrBinaryDigits BinaryDigit
BinaryDigit ::: one of
0 1
---*/
assert.sameValue(parseFloat("0b0_1"), 0b0);
assert.sameValue(parseFloat("0B0_1"), 0B0);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0b StrBinaryDigits, 0B StrBinaryDigits
info: |
StrBinaryIntegerLiteral :::
0b StrBinaryDigits
0B StrBinaryDigits
StrBinaryDigits :::
BinaryDigit
StrBinaryDigits BinaryDigit
BinaryDigit ::: one of
0 1
---*/
assert.sameValue(parseFloat("0b0_10"), 0b0);
assert.sameValue(parseFloat("0B0_10"), 0B0);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0b StrBinaryDigits, 0B StrBinaryDigits
info: |
StrBinaryIntegerLiteral :::
0b StrBinaryDigits
0B StrBinaryDigits
StrBinaryDigits :::
BinaryDigit
StrBinaryDigits BinaryDigit
BinaryDigit ::: one of
0 1
---*/
assert.sameValue(parseFloat("0b01_0"), 0b01);
assert.sameValue(parseFloat("0B01_0"), 0B01);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0b StrBinaryDigits, 0B StrBinaryDigits
info: |
StrBinaryIntegerLiteral :::
0b StrBinaryDigits
0B StrBinaryDigits
StrBinaryDigits :::
BinaryDigit
StrBinaryDigits BinaryDigit
BinaryDigit ::: one of
0 1
---*/
assert.sameValue(parseFloat("0b01_00"), 0b01);
assert.sameValue(parseFloat("0B01_00"), 0B01);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0x StrHexDigits, 0X StrHexDigits
info: |
StrHexLiteral :::
0x StrHexDigits
0X StrHexDigits
StrHexDigits :::
HexDigit
StrHexDigits HexDigit
---*/
assert.sameValue(parseFloat("0x0_1"), 0x0);
assert.sameValue(parseFloat("0X0_1"), 0X0);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0x StrHexDigits, 0X StrHexDigits
info: |
StrHexLiteral :::
0x StrHexDigits
0X StrHexDigits
StrHexDigits :::
HexDigit
StrHexDigits HexDigit
---*/
assert.sameValue(parseFloat("0x0_10"), 0x0);
assert.sameValue(parseFloat("0X0_10"), 0X0);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0x StrHexDigits, 0X StrHexDigits
info: |
StrHexLiteral :::
0x StrHexDigits
0X StrHexDigits
StrHexDigits :::
HexDigit
StrHexDigits HexDigit
---*/
assert.sameValue(parseFloat("0x01_0"), 0x01);
assert.sameValue(parseFloat("0X01_0"), 0X01);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0x StrHexDigits, 0X StrHexDigits
info: |
StrHexLiteral :::
0x StrHexDigits
0X StrHexDigits
StrHexDigits :::
HexDigit
StrHexDigits HexDigit
---*/
assert.sameValue(parseFloat("0x01_00"), 0x01);
assert.sameValue(parseFloat("0X01_00"), 0X01);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0x StrHexDigits, 0X StrHexDigits
info: |
StrHexLiteral :::
0x StrHexDigits
0X StrHexDigits
StrHexDigits :::
HexDigit
StrHexDigits HexDigit
---*/
assert.sameValue(parseFloat("0x0_0"), 0x0);
assert.sameValue(parseFloat("0x1_1"), 0x1);
assert.sameValue(parseFloat("0x2_2"), 0x2);
assert.sameValue(parseFloat("0x3_3"), 0x3);
assert.sameValue(parseFloat("0x4_4"), 0x4);
assert.sameValue(parseFloat("0x5_5"), 0x5);
assert.sameValue(parseFloat("0x6_6"), 0x6);
assert.sameValue(parseFloat("0x7_7"), 0x7);
assert.sameValue(parseFloat("0x8_8"), 0x8);
assert.sameValue(parseFloat("0x9_9"), 0x9);
assert.sameValue(parseFloat("0xa_a"), 0xa);
assert.sameValue(parseFloat("0xb_b"), 0xb);
assert.sameValue(parseFloat("0xc_c"), 0xc);
assert.sameValue(parseFloat("0xd_d"), 0xd);
assert.sameValue(parseFloat("0xe_e"), 0xe);
assert.sameValue(parseFloat("0xf_f"), 0xf);
assert.sameValue(parseFloat("0xA_A"), 0xA);
assert.sameValue(parseFloat("0xB_B"), 0xB);
assert.sameValue(parseFloat("0xC_C"), 0xC);
assert.sameValue(parseFloat("0xD_D"), 0xD);
assert.sameValue(parseFloat("0xE_E"), 0xE);
assert.sameValue(parseFloat("0xF_F"), 0xF);
......@@ -6,7 +6,7 @@ esid: sec-tonumber-applied-to-the-string-type
description: NonZeroDigit NumericLiteralSeparator DecimalDigit
info: |
StrStrUnsignedDecimalLiteral :::
StrUnsignedDecimalLiteral :::
StrUnsignedDecimalLiteral
NonZeroDigit ::: one of
......
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0o StrOctalDigits, 0O StrOctalDigits
info: |
StrOctalLiteral :::
0o StrOctalDigits
0O StrOctalDigits
StrOctalDigits :::
OctalDigit
StrOctalDigits OctalDigit
---*/
assert.sameValue(parseFloat("0o0_0"), 0o0);
assert.sameValue(parseFloat("0o1_1"), 0o1);
assert.sameValue(parseFloat("0o2_2"), 0o2);
assert.sameValue(parseFloat("0o3_3"), 0o3);
assert.sameValue(parseFloat("0o4_4"), 0o4);
assert.sameValue(parseFloat("0o5_5"), 0o5);
assert.sameValue(parseFloat("0o6_6"), 0o6);
assert.sameValue(parseFloat("0o7_7"), 0o7);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0o StrOctalDigits, 0O StrOctalDigits
info: |
StrOctalLiteral :::
0o StrOctalDigits
0O StrOctalDigits
StrOctalDigits :::
OctalDigit
StrOctalDigits OctalDigit
---*/
assert.sameValue(parseFloat("0o0_1"), 0o0);
assert.sameValue(parseFloat("0O0_1"), 0O0);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0o StrOctalDigits, 0O StrOctalDigits
info: |
StrOctalLiteral :::
0o StrOctalDigits
0O StrOctalDigits
StrOctalDigits :::
OctalDigit
StrOctalDigits OctalDigit
---*/
assert.sameValue(parseFloat("0o0_10"), 0o0);
assert.sameValue(parseFloat("0O0_10"), 0O0);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0o StrOctalDigits, 0O StrOctalDigits
info: |
StrOctalLiteral :::
0o StrOctalDigits
0O StrOctalDigits
StrOctalDigits :::
OctalDigit
StrOctalDigits OctalDigit
---*/
assert.sameValue(parseFloat("0o01_0"), 0o01);
assert.sameValue(parseFloat("0O01_0"), 0O01);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: 0o StrOctalDigits, 0O StrOctalDigits
info: |
StrOctalLiteral :::
0o StrOctalDigits
0O StrOctalDigits
StrOctalDigits :::
OctalDigit
StrOctalDigits OctalDigit
---*/
assert.sameValue(parseFloat("0o01_00"), 0o01);
assert.sameValue(parseFloat("0O01_00"), 0O01);
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-tonumber-applied-to-the-string-type
description: >
StrUnsignedDecimalLiteral, + StrUnsignedDecimalLiteral, - StrUnsignedDecimalLiteral
info: |
StrDecimalLiteral :::
StrUnsignedDecimalLiteral
+ StrUnsignedDecimalLiteral
- StrUnsignedDecimalLiteral
---*/
assert.sameValue(parseFloat("-123456789_0"), -123456789);
assert.sameValue(parseFloat("-123456789_1"), -123456789);
assert.sameValue(parseFloat("-123456789_2"), -123456789);
assert.sameValue(parseFloat("-123456789_3"), -123456789);
assert.sameValue(parseFloat("-123456789_4"), -123456789);
assert.sameValue(parseFloat("-123456789_5"), -123456789);
assert.sameValue(parseFloat("-123456789_6"), -123456789);
assert.sameValue(parseFloat("-123456789_7"), -123456789);
assert.sameValue(parseFloat("-123456789_8"), -123456789);
assert.sameValue(parseFloat("-123456789_9"), -123456789);
......@@ -25,6 +25,8 @@ info: |
negative:
phase: early
type: SyntaxError
features: [numeric-separator-literal]
---*/
throw "Test262: This statement should not be evaluated.";
......
......@@ -21,6 +21,7 @@ info: |
BinaryDigit :: one of
0 1
features: [numeric-separator-literal]
---*/
assert.sameValue(0b0_1, 0b01);
......
......@@ -21,6 +21,7 @@ info: |
BinaryDigit :: one of
0 1
features: [numeric-separator-literal]
---*/
assert.sameValue(0b0_10, 0b010);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment