| 1 |
// Copyright 2016 André Bargull. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
esid: sec-tonumber-applied-to-the-string-type |
| 6 |
description: > |
| 7 |
Ensure U+180E is not recognized as whitespace, test ToNumber with static string |
| 8 |
info: | |
| 9 |
7.1.3.1 ToNumber Applied to the String Type |
| 10 |
|
| 11 |
If the grammar cannot interpret the String as an expansion of |
| 12 |
StringNumericLiteral, then the result of ToNumber is NaN. |
| 13 |
|
| 14 |
StringNumericLiteral ::: |
| 15 |
StrWhiteSpace_opt StrNumericLiteral StrWhiteSpace_opt |
| 16 |
StrWhiteSpace ::: |
| 17 |
StrWhiteSpaceChar StrWhiteSpace_opt |
| 18 |
StrWhiteSpaceChar ::: |
| 19 |
WhiteSpace |
| 20 |
LineTerminator |
| 21 |
WhiteSpace :: |
| 22 |
<TAB> |
| 23 |
<VT> |
| 24 |
<FF> |
| 25 |
<SP> |
| 26 |
<NBSP> |
| 27 |
<ZWNBSP> |
| 28 |
<USP> |
| 29 |
<USP> :: |
| 30 |
Other category “Zs” code points |
| 31 |
features: [u180e] |
| 32 |
---*/ |
| 33 |
|
| 34 |
// CHECK#1 |
| 35 |
assert.sameValue(Number('\u180E'), NaN, 'Number("\\u180E") === NaN'); |
| 36 |
|
| 37 |
// CHECK#2 |
| 38 |
assert.sameValue(Number('\u180E1234567890\u180E'), NaN, 'Number("\u180E1234567890\u180E") === NaN'); |
| 39 |
|
| 40 |
// CHECK#3 |
| 41 |
assert.sameValue(Number('\u180EInfinity\u180E'), NaN, 'Number("\u180EInfinity\u180E") === NaN'); |
| 42 |
|
| 43 |
// CHECK#4 |
| 44 |
assert.sameValue(Number('\u180E-Infinity\u180E'), NaN, 'Number("\u180E-Infinity\u180E") === NaN'); |