Ensure U+180E is no longer considered whitespace

Ref. https://hashseed.blogspot.com/2014/08/in-ecma-262-5.html
Ref. https://github.com/tc39/ecma262/pull/300#issuecomment-181376767
Ref. 9b10d2a597

Fix and add @anba’s U+180E tests
This commit is contained in:
Mathias Bynens 2016-06-29 09:39:00 +02:00 committed by Mike Pennisi
parent ab4ff914fb
commit 3a5a09eba2
33 changed files with 767 additions and 207 deletions

View File

@ -9,6 +9,6 @@ description: >
---*/
assert.throws(SyntaxError, function() {
// the following should produce a syntax error
JSON.parse('\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u30001234');
// the following should produce a syntax error
JSON.parse('\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u30001234');
});

View File

@ -10,12 +10,12 @@ description: >
---*/
// CHECK#1
if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== 0) {
$ERROR('#1.1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === 0. Actual: ' + (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")));
if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== 0) {
$ERROR('#1.1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === 0. Actual: ' + (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")));
} else {
if (1/Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number.POSITIVE_INFINITY) {
$ERROR('#1.2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === +0. Actual: -0');
}
if (1/Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number.POSITIVE_INFINITY) {
$ERROR('#1.2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === +0. Actual: -0');
}
}
// CHECK#2
@ -24,7 +24,7 @@ if (Number(" ") !== 0) {
} else {
if (1/Number(" ") !== Number.POSITIVE_INFINITY) {
$ERROR('#2.2: Number(" ") === +0. Actual: -0');
}
}
}
// CHECK#3
@ -33,7 +33,7 @@ if (Number("\t") !== 0) {
} else {
if (1/Number("\t") !== Number.POSITIVE_INFINITY) {
$ERROR('#3.2: Number("\\t") === +0. Actual: -0');
}
}
}
// CHECK#4
@ -42,7 +42,7 @@ if (Number("\r") !== 0) {
} else {
if (1/Number("\r") !== Number.POSITIVE_INFINITY) {
$ERROR('#4.2: Number("\\r") === +0. Actual: -0');
}
}
}
// CHECK#5
@ -51,7 +51,7 @@ if (Number("\n") !== 0) {
} else {
if (1/Number("\n") !== Number.POSITIVE_INFINITY) {
$ERROR('#5.2: Number("\\n") === +0. Actual: -0');
}
}
}
// CHECK#6
@ -60,7 +60,7 @@ if (Number("\f") !== 0) {
} else {
if (1/Number("\f") !== Number.POSITIVE_INFINITY) {
$ERROR('#6.2: Number("\\f") === +0. Actual: -0');
}
}
}
// CHECK#7
@ -69,7 +69,7 @@ if (Number("\u0009") !== 0) {
} else {
if (1/Number("\u0009") !== Number.POSITIVE_INFINITY) {
$ERROR('#7.2: Number("\\u0009") === +0. Actual: -0');
}
}
}
// CHECK#8
@ -78,7 +78,7 @@ if (Number("\u000A") !== 0) {
} else {
if (1/Number("\u000A") !== Number.POSITIVE_INFINITY) {
$ERROR('#8.2: Number("\\u000A") === +0. Actual: -0');
}
}
}
// CHECK#9
@ -87,7 +87,7 @@ if (Number("\u000B") !== 0) {
} else {
if (1/Number("\u000B") !== Number.POSITIVE_INFINITY) {
$ERROR('#9.1.2: Number("\\u000B") === +0. Actual: -0');
}
}
}
// CHECK#10
@ -96,7 +96,7 @@ if (Number("\u000C") !== 0) {
} else {
if (1/Number("\u000C") !== Number.POSITIVE_INFINITY) {
$ERROR('#10.2: Number("\\u000C") === +0. Actual: -0');
}
}
}
// CHECK#11
@ -105,7 +105,7 @@ if (Number("\u000D") !== 0) {
} else {
if (1/Number("\u000D") !== Number.POSITIVE_INFINITY) {
$ERROR('#11.2: Number("\\u000D") === +0. Actual: -0');
}
}
}
// CHECK#12
@ -114,7 +114,7 @@ if (Number("\u00A0") !== 0) {
} else {
if (1/Number("\u00A0") !== Number.POSITIVE_INFINITY) {
$ERROR('#12.2: Number("\\u00A0") === +0. Actual: -0');
}
}
}
// CHECK#13
@ -123,7 +123,7 @@ if (Number("\u0020") !== 0) {
} else {
if (1/Number("\u0020") !== Number.POSITIVE_INFINITY) {
$ERROR('#13.2: Number("\\u0020") === +0. Actual: -0');
}
}
}
// CHECK#14
@ -132,7 +132,7 @@ if (Number("\u2028") !== 0) {
} else {
if (1/Number("\u2028") !== Number.POSITIVE_INFINITY) {
$ERROR('#14.2: Number("\\u2028") === +0. Actual: -0');
}
}
}
// CHECK#15
@ -141,7 +141,7 @@ if (Number("\u2029") !== 0) {
} else {
if (1/Number("\u2029") !== Number.POSITIVE_INFINITY) {
$ERROR('#15.2: Number("\\u2029") === +0. Actual: -0');
}
}
}
// CHECK#16
@ -150,140 +150,131 @@ if (Number("\u1680") !== 0) {
} else {
if (1/Number("\u1680") !== Number.POSITIVE_INFINITY) {
$ERROR('#16.2: Number("\\u1680") === +0. Actual: -0');
}
}
}
// CHECK#17
if (Number("\u180E") !== 0) {
$ERROR('#17.1: Number("\\u180E") === 0. Actual: ' + (Number("\u180E")));
if (Number("\u2000") !== 0) {
$ERROR('#17.1: Number("\\u2000") === 0. Actual: ' + (Number("\u2000")));
} else {
if (1/Number("\u180E") !== Number.POSITIVE_INFINITY) {
$ERROR('#17.2: Number("\\u180E") === +0. Actual: -0');
}
if (1/Number("\u2000") !== Number.POSITIVE_INFINITY) {
$ERROR('#17.2: Number("\\u2000") === +0. Actual: -0');
}
}
// CHECK#18
if (Number("\u2000") !== 0) {
$ERROR('#18.1: Number("\\u2000") === 0. Actual: ' + (Number("\u2000")));
if (Number("\u2001") !== 0) {
$ERROR('#18.1: Number("\\u2001") === 0. Actual: ' + (Number("\u2001")));
} else {
if (1/Number("\u2000") !== Number.POSITIVE_INFINITY) {
$ERROR('#18.2: Number("\\u2000") === +0. Actual: -0');
}
if (1/Number("\u2001") !== Number.POSITIVE_INFINITY) {
$ERROR('#18.2: Number("\\u2001") === +0. Actual: -0');
}
}
// CHECK#19
if (Number("\u2001") !== 0) {
$ERROR('#19.1: Number("\\u2001") === 0. Actual: ' + (Number("\u2001")));
if (Number("\u2002") !== 0) {
$ERROR('#19.1: Number("\\u2002") === 0. Actual: ' + (Number("\u2002")));
} else {
if (1/Number("\u2001") !== Number.POSITIVE_INFINITY) {
$ERROR('#19.2: Number("\\u2001") === +0. Actual: -0');
}
if (1/Number("\u2002") !== Number.POSITIVE_INFINITY) {
$ERROR('#19.2: Number("\\u2002") === +0. Actual: -0');
}
}
// CHECK#20
if (Number("\u2002") !== 0) {
$ERROR('#20.1: Number("\\u2002") === 0. Actual: ' + (Number("\u2002")));
if (Number("\u2003") !== 0) {
$ERROR('#20.1: Number("\\u2003") === 0. Actual: ' + (Number("\u2003")));
} else {
if (1/Number("\u2002") !== Number.POSITIVE_INFINITY) {
$ERROR('#20.2: Number("\\u2002") === +0. Actual: -0');
}
if (1/Number("\u2003") !== Number.POSITIVE_INFINITY) {
$ERROR('#20.2: Number("\\u2003") === +0. Actual: -0');
}
}
// CHECK#21
if (Number("\u2003") !== 0) {
$ERROR('#21.1: Number("\\u2003") === 0. Actual: ' + (Number("\u2003")));
if (Number("\u2004") !== 0) {
$ERROR('#21.1: Number("\\u2004") === 0. Actual: ' + (Number("\u2004")));
} else {
if (1/Number("\u2003") !== Number.POSITIVE_INFINITY) {
$ERROR('#21.2: Number("\\u2003") === +0. Actual: -0');
}
if (1/Number("\u2004") !== Number.POSITIVE_INFINITY) {
$ERROR('#21.2: Number("\\u2004") === +0. Actual: -0');
}
}
// CHECK#22
if (Number("\u2004") !== 0) {
$ERROR('#22.1: Number("\\u2004") === 0. Actual: ' + (Number("\u2004")));
if (Number("\u2005") !== 0) {
$ERROR('#22.1: Number("\\u2005") === 0. Actual: ' + (Number("\u2005")));
} else {
if (1/Number("\u2004") !== Number.POSITIVE_INFINITY) {
$ERROR('#22.2: Number("\\u2004") === +0. Actual: -0');
}
if (1/Number("\u2005") !== Number.POSITIVE_INFINITY) {
$ERROR('#22.2: Number("\\u2005") === +0. Actual: -0');
}
}
// CHECK#23
if (Number("\u2005") !== 0) {
$ERROR('#23.1: Number("\\u2005") === 0. Actual: ' + (Number("\u2005")));
if (Number("\u2006") !== 0) {
$ERROR('#23.1: Number("\\u2006") === 0. Actual: ' + (Number("\u2006")));
} else {
if (1/Number("\u2005") !== Number.POSITIVE_INFINITY) {
$ERROR('#23.2: Number("\\u2005") === +0. Actual: -0');
}
if (1/Number("\u2006") !== Number.POSITIVE_INFINITY) {
$ERROR('#23.2: Number("\\u2006") === +0. Actual: -0');
}
}
// CHECK#24
if (Number("\u2006") !== 0) {
$ERROR('#24.1: Number("\\u2006") === 0. Actual: ' + (Number("\u2006")));
if (Number("\u2007") !== 0) {
$ERROR('#24.1: Number("\\u2007") === 0. Actual: ' + (Number("\u2007")));
} else {
if (1/Number("\u2006") !== Number.POSITIVE_INFINITY) {
$ERROR('#24.2: Number("\\u2006") === +0. Actual: -0');
}
if (1/Number("\u2007") !== Number.POSITIVE_INFINITY) {
$ERROR('#24.2: Number("\\u2007") === +0. Actual: -0');
}
}
// CHECK#25
if (Number("\u2007") !== 0) {
$ERROR('#25.1: Number("\\u2007") === 0. Actual: ' + (Number("\u2007")));
if (Number("\u2008") !== 0) {
$ERROR('#25.1: Number("\\u2008") === 0. Actual: ' + (Number("\u2008")));
} else {
if (1/Number("\u2007") !== Number.POSITIVE_INFINITY) {
$ERROR('#25.2: Number("\\u2007") === +0. Actual: -0');
}
if (1/Number("\u2008") !== Number.POSITIVE_INFINITY) {
$ERROR('#25.2: Number("\\u2008") === +0. Actual: -0');
}
}
// CHECK#26
if (Number("\u2008") !== 0) {
$ERROR('#26.1: Number("\\u2008") === 0. Actual: ' + (Number("\u2008")));
if (Number("\u2009") !== 0) {
$ERROR('#26.1: Number("\\u2009") === 0. Actual: ' + (Number("\u2009")));
} else {
if (1/Number("\u2008") !== Number.POSITIVE_INFINITY) {
$ERROR('#26.2: Number("\\u2008") === +0. Actual: -0');
}
if (1/Number("\u2009") !== Number.POSITIVE_INFINITY) {
$ERROR('#26.2: Number("\\u2009") === +0. Actual: -0');
}
}
// CHECK#27
if (Number("\u2009") !== 0) {
$ERROR('#27.1: Number("\\u2009") === 0. Actual: ' + (Number("\u2009")));
if (Number("\u200A") !== 0) {
$ERROR('#27.1: Number("\\u200A") === 0. Actual: ' + (Number("\u200A")));
} else {
if (1/Number("\u2009") !== Number.POSITIVE_INFINITY) {
$ERROR('#27.2: Number("\\u2009") === +0. Actual: -0');
}
if (1/Number("\u200A") !== Number.POSITIVE_INFINITY) {
$ERROR('#27.2: Number("\\u200A") === +0. Actual: -0');
}
}
// CHECK#28
if (Number("\u200A") !== 0) {
$ERROR('#28.1: Number("\\u200A") === 0. Actual: ' + (Number("\u200A")));
if (Number("\u202F") !== 0) {
$ERROR('#28.1: Number("\\u202F") === 0. Actual: ' + (Number("\u202F")));
} else {
if (1/Number("\u200A") !== Number.POSITIVE_INFINITY) {
$ERROR('#28.2: Number("\\u200A") === +0. Actual: -0');
}
if (1/Number("\u202F") !== Number.POSITIVE_INFINITY) {
$ERROR('#28.2: Number("\\u202F") === +0. Actual: -0');
}
}
// CHECK#29
if (Number("\u202F") !== 0) {
$ERROR('#29.1: Number("\\u202F") === 0. Actual: ' + (Number("\u202F")));
if (Number("\u205F") !== 0) {
$ERROR('#29.1: Number("\\u205F") === 0. Actual: ' + (Number("\u205F")));
} else {
if (1/Number("\u202F") !== Number.POSITIVE_INFINITY) {
$ERROR('#29.2: Number("\\u202F") === +0. Actual: -0');
}
if (1/Number("\u205F") !== Number.POSITIVE_INFINITY) {
$ERROR('#29.2: Number("\\u205F") === +0. Actual: -0');
}
}
// CHECK#30
if (Number("\u205F") !== 0) {
$ERROR('#30.1: Number("\\u205F") === 0. Actual: ' + (Number("\u205F")));
} else {
if (1/Number("\u205F") !== Number.POSITIVE_INFINITY) {
$ERROR('#30.2: Number("\\u205F") === +0. Actual: -0');
}
}
// CHECK#31
if (Number("\u3000") !== 0) {
$ERROR('#31.1: Number("\\u3000") === 0. Actual: ' + (Number("\u3000")));
$ERROR('#30.1: Number("\\u3000") === 0. Actual: ' + (Number("\u3000")));
} else {
if (1/Number("\u3000") !== Number.POSITIVE_INFINITY) {
$ERROR('#31.2: Number("\\u3000") === +0. Actual: -0');
}
$ERROR('#30.2: Number("\\u3000") === +0. Actual: -0');
}
}

View File

@ -0,0 +1,33 @@
// Copyright 2016 André Bargull. 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: >
Ensure U+180E is not recognized as whitespace, convert to Number by explicit transformation
info: >
7.1.3.1 ToNumber Applied to the String Type
If the grammar cannot interpret the String as an expansion of
StringNumericLiteral, then the result of ToNumber is NaN.
StringNumericLiteral :::
StrWhiteSpace_opt StrNumericLiteral StrWhiteSpace_opt
StrWhiteSpace :::
StrWhiteSpaceChar StrWhiteSpace_opt
StrWhiteSpaceChar :::
WhiteSpace
LineTerminator
WhiteSpace ::
<TAB>
<VT>
<FF>
<SP>
<NBSP>
<ZWNBSP>
<USP>
<USP> ::
Other category Zs code points
---*/
assert.sameValue(Number('\u180E'), NaN, 'Number("\\u180E") === NaN. Actual: ' + (Number("\u180E")));

View File

@ -11,21 +11,21 @@ description: static string
---*/
// CHECK#1
if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number("")) {
$ERROR('#1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("")');
if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number("")) {
$ERROR('#1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("")');
}
// CHECK#2
if (Number("\u0009\u000C\u0020\u00A0\u000A\u000D\u2028\u2029\u000B\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u30001234567890\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number("1234567890")) {
$ERROR('#2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029\\u000B\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u30001234567890\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("1234567890")');
if (Number("\u0009\u000C\u0020\u00A0\u000A\u000D\u2028\u2029\u000B\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u30001234567890\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number("1234567890")) {
$ERROR('#2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029\\u000B\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u30001234567890\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("1234567890")');
}
// CHECK#3
if (!(+("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000Infinity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") == Number("Infinity"))) {
$ERROR('#3: +("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000Infinity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("Infinity")');
if (!(+("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000Infinity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") == Number("Infinity"))) {
$ERROR('#3: +("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000Infinity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("Infinity")');
}
// CHECK#4
if (!(Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000-Infinity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") == Number(-"Infinity"))) {
$ERROR('#4: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000-Infinity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("-Infinity")');
if (!(Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000-Infinity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") == Number(-"Infinity"))) {
$ERROR('#4: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000-Infinity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("-Infinity")');
}

View File

@ -0,0 +1,43 @@
// Copyright 2016 André Bargull. 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: >
Ensure U+180E is not recognized as whitespace, test ToNumber with static string
info: >
7.1.3.1 ToNumber Applied to the String Type
If the grammar cannot interpret the String as an expansion of
StringNumericLiteral, then the result of ToNumber is NaN.
StringNumericLiteral :::
StrWhiteSpace_opt StrNumericLiteral StrWhiteSpace_opt
StrWhiteSpace :::
StrWhiteSpaceChar StrWhiteSpace_opt
StrWhiteSpaceChar :::
WhiteSpace
LineTerminator
WhiteSpace ::
<TAB>
<VT>
<FF>
<SP>
<NBSP>
<ZWNBSP>
<USP>
<USP> ::
Other category Zs code points
---*/
// CHECK#1
assert.sameValue(Number('\u180E'), NaN, 'Number("\\u180E") === NaN');
// CHECK#2
assert.sameValue(Number('\u180E1234567890\u180E'), NaN, 'Number("\u180E1234567890\u180E") === NaN');
// CHECK#3
assert.sameValue(Number('\u180EInfinity\u180E'), NaN, 'Number("\u180EInfinity\u180E") === NaN');
// CHECK#4
assert.sameValue(Number('\u180E-Infinity\u180E'), NaN, 'Number("\u180E-Infinity\u180E") === NaN');

View File

@ -15,21 +15,21 @@ function dynaString(s1, s2){
}
// CHECK#1
if (Number(dynaString("\u0009\u000C\u0020\u00A0\u000B", "\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) !== Number("")) {
$ERROR('#1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B"+"\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("")');
if (Number(dynaString("\u0009\u000C\u0020\u00A0\u000B", "\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) !== Number("")) {
$ERROR('#1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B"+"\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("")');
}
// CHECK#2
if (+(dynaString("\u0009\u000C\u0020\u00A0\u000A\u000D\u2028\u2029\u000B12345", "67890\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) !== Number("1234567890")) {
$ERROR('#2: +("\\u0009\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029\\u000B12345"+"67890\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("1234567890")');
if (+(dynaString("\u0009\u000C\u0020\u00A0\u000A\u000D\u2028\u2029\u000B12345", "67890\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) !== Number("1234567890")) {
$ERROR('#2: +("\\u0009\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029\\u000B12345"+"67890\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("1234567890")');
}
// CHECK#3
if (!(Number(dynaString("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029Infi", "nity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) == Number("Infinity"))) {
$ERROR('#3: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029Infi"+"nity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("Infinity")');
if (!(Number(dynaString("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029Infi", "nity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) == Number("Infinity"))) {
$ERROR('#3: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029Infi"+"nity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("Infinity")');
}
// CHECK#4
if (!(Number(dynaString("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029-Infi", "nity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) == Number(-"Infinity"))) {
$ERROR('#4: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029-Infi"+"nity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("-Infinity")');
if (!(Number(dynaString("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029-Infi", "nity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) == Number(-"Infinity"))) {
$ERROR('#4: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029-Infi"+"nity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("-Infinity")');
}

View File

@ -0,0 +1,47 @@
// Copyright 2016 André Bargull. 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: >
Ensure U+180E is not recognized as whitespace, test ToNumber with dynamic string
info: >
7.1.3.1 ToNumber Applied to the String Type
If the grammar cannot interpret the String as an expansion of
StringNumericLiteral, then the result of ToNumber is NaN.
StringNumericLiteral :::
StrWhiteSpace_opt StrNumericLiteral StrWhiteSpace_opt
StrWhiteSpace :::
StrWhiteSpaceChar StrWhiteSpace_opt
StrWhiteSpaceChar :::
WhiteSpace
LineTerminator
WhiteSpace ::
<TAB>
<VT>
<FF>
<SP>
<NBSP>
<ZWNBSP>
<USP>
<USP> ::
Other category Zs code points
---*/
function dynaString(s1, s2){
return String(s1) + String(s2);
}
// CHECK#1
assert.sameValue(Number(dynaString("", "\u180E")), NaN, 'Number(dynaString("", "\u180E")) === NaN');
// CHECK#2
assert.sameValue(+(dynaString("12345", "67890\u180E")), NaN, '+(dynaString("12345", "67890\u180E")) === NaN');
// CHECK#3
assert.sameValue(Number(dynaString("Infi", "nity\u180E")), NaN, 'Number(dynaString("Infi", "nity\u180E")) === NaN');
// CHECK#4
assert.sameValue(Number(dynaString("-Infi", "nity\u180E")), NaN, 'Number(dynaString("-Infi", "nity\u180E")) === NaN');

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ description: WhiteSpace
---*/
var i0 = "";
for (var j = 0; j < 1024; j++)
for (var j = 0x0000; j < 0x0400; j++)
i0 += String.fromCharCode(j);
var o0 = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0";
if (i0.replace(/\S+/g, "") !== o0) {
@ -19,7 +19,7 @@ if (i0.replace(/\S+/g, "") !== o0) {
}
var i1 = "";
for (var j = 1024; j < 2048; j++)
for (var j = 0x0400; j < 0x0800; j++)
i1 += String.fromCharCode(j);
var o1 = "";
if (i1.replace(/\S+/g, "") !== o1) {
@ -27,7 +27,7 @@ if (i1.replace(/\S+/g, "") !== o1) {
}
var i2 = "";
for (var j = 2048; j < 3072; j++)
for (var j = 0x0800; j < 0x0C00; j++)
i2 += String.fromCharCode(j);
var o2 = "";
if (i2.replace(/\S+/g, "") !== o2) {
@ -35,7 +35,7 @@ if (i2.replace(/\S+/g, "") !== o2) {
}
var i3 = "";
for (var j = 3072; j < 4096; j++)
for (var j = 0x0C00; j < 0x1000; j++)
i3 += String.fromCharCode(j);
var o3 = "";
if (i3.replace(/\S+/g, "") !== o3) {
@ -43,7 +43,7 @@ if (i3.replace(/\S+/g, "") !== o3) {
}
var i4 = "";
for (var j = 4096; j < 5120; j++)
for (var j = 0x1000; j < 0x1400; j++)
i4 += String.fromCharCode(j);
var o4 = "";
if (i4.replace(/\S+/g, "") !== o4) {
@ -51,7 +51,7 @@ if (i4.replace(/\S+/g, "") !== o4) {
}
var i5 = "";
for (var j = 5120; j < 6144; j++)
for (var j = 0x1400; j < 0x1800; j++)
i5 += String.fromCharCode(j);
var o5 = "\u1680";
if (i5.replace(/\S+/g, "") !== o5) {
@ -59,15 +59,15 @@ if (i5.replace(/\S+/g, "") !== o5) {
}
var i6 = "";
for (var j = 6144; j < 7168; j++)
for (var j = 0x1800; j < 0x1C00; j++)
i6 += String.fromCharCode(j);
var o6 = "\u180E";
var o6 = "";
if (i6.replace(/\S+/g, "") !== o6) {
$ERROR("#6: Error matching character class \S between character 1800 and 1bff");
}
var i7 = "";
for (var j = 7168; j < 8192; j++)
for (var j = 0x1C00; j < 0x2000; j++)
i7 += String.fromCharCode(j);
var o7 = "";
if (i7.replace(/\S+/g, "") !== o7) {
@ -75,7 +75,7 @@ if (i7.replace(/\S+/g, "") !== o7) {
}
var i8 = "";
for (var j = 8192; j < 9216; j++)
for (var j = 0x2000; j < 0x2400; j++)
i8 += String.fromCharCode(j);
var o8 = "\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F";
if (i8.replace(/\S+/g, "") !== o8) {
@ -83,7 +83,7 @@ if (i8.replace(/\S+/g, "") !== o8) {
}
var i9 = "";
for (var j = 9216; j < 10240; j++)
for (var j = 0x2400; j < 0x2800; j++)
i9 += String.fromCharCode(j);
var o9 = "";
if (i9.replace(/\S+/g, "") !== o9) {
@ -91,7 +91,7 @@ if (i9.replace(/\S+/g, "") !== o9) {
}
var i10 = "";
for (var j = 10240; j < 11264; j++)
for (var j = 0x2800; j < 0x2C00; j++)
i10 += String.fromCharCode(j);
var o10 = "";
if (i10.replace(/\S+/g, "") !== o10) {
@ -99,7 +99,7 @@ if (i10.replace(/\S+/g, "") !== o10) {
}
var i11 = "";
for (var j = 11264; j < 12288; j++)
for (var j = 0x2C00; j < 0x3000; j++)
i11 += String.fromCharCode(j);
var o11 = "";
if (i11.replace(/\S+/g, "") !== o11) {
@ -107,7 +107,7 @@ if (i11.replace(/\S+/g, "") !== o11) {
}
var i12 = "";
for (var j = 12288; j < 13312; j++)
for (var j = 0x3000; j < 0x3400; j++)
i12 += String.fromCharCode(j);
var o12 = "\u3000";
if (i12.replace(/\S+/g, "") !== o12) {
@ -115,7 +115,7 @@ if (i12.replace(/\S+/g, "") !== o12) {
}
var i13 = "";
for (var j = 13312; j < 14336; j++)
for (var j = 0x3400; j < 0x3800; j++)
i13 += String.fromCharCode(j);
var o13 = "";
if (i13.replace(/\S+/g, "") !== o13) {
@ -123,7 +123,7 @@ if (i13.replace(/\S+/g, "") !== o13) {
}
var i14 = "";
for (var j = 14336; j < 15360; j++)
for (var j = 0x3800; j < 0x3C00; j++)
i14 += String.fromCharCode(j);
var o14 = "";
if (i14.replace(/\S+/g, "") !== o14) {
@ -131,7 +131,7 @@ if (i14.replace(/\S+/g, "") !== o14) {
}
var i15 = "";
for (var j = 15360; j < 16384; j++)
for (var j = 0x3C00; j < 0x4000; j++)
i15 += String.fromCharCode(j);
var o15 = "";
if (i15.replace(/\S+/g, "") !== o15) {
@ -139,7 +139,7 @@ if (i15.replace(/\S+/g, "") !== o15) {
}
var i16 = "";
for (var j = 16384; j < 17408; j++)
for (var j = 0x4000; j < 0x4400; j++)
i16 += String.fromCharCode(j);
var o16 = "";
if (i16.replace(/\S+/g, "") !== o16) {
@ -147,7 +147,7 @@ if (i16.replace(/\S+/g, "") !== o16) {
}
var i17 = "";
for (var j = 17408; j < 18432; j++)
for (var j = 0x4400; j < 0x4800; j++)
i17 += String.fromCharCode(j);
var o17 = "";
if (i17.replace(/\S+/g, "") !== o17) {
@ -155,7 +155,7 @@ if (i17.replace(/\S+/g, "") !== o17) {
}
var i18 = "";
for (var j = 18432; j < 19456; j++)
for (var j = 0x4800; j < 0x4C00; j++)
i18 += String.fromCharCode(j);
var o18 = "";
if (i18.replace(/\S+/g, "") !== o18) {
@ -163,7 +163,7 @@ if (i18.replace(/\S+/g, "") !== o18) {
}
var i19 = "";
for (var j = 19456; j < 20480; j++)
for (var j = 0x4C00; j < 0x5000; j++)
i19 += String.fromCharCode(j);
var o19 = "";
if (i19.replace(/\S+/g, "") !== o19) {
@ -171,7 +171,7 @@ if (i19.replace(/\S+/g, "") !== o19) {
}
var i20 = "";
for (var j = 20480; j < 21504; j++)
for (var j = 0x5000; j < 0x5400; j++)
i20 += String.fromCharCode(j);
var o20 = "";
if (i20.replace(/\S+/g, "") !== o20) {
@ -179,7 +179,7 @@ if (i20.replace(/\S+/g, "") !== o20) {
}
var i21 = "";
for (var j = 21504; j < 22528; j++)
for (var j = 0x5400; j < 0x5800; j++)
i21 += String.fromCharCode(j);
var o21 = "";
if (i21.replace(/\S+/g, "") !== o21) {
@ -187,7 +187,7 @@ if (i21.replace(/\S+/g, "") !== o21) {
}
var i22 = "";
for (var j = 22528; j < 23552; j++)
for (var j = 0x5800; j < 0x5C00; j++)
i22 += String.fromCharCode(j);
var o22 = "";
if (i22.replace(/\S+/g, "") !== o22) {
@ -195,7 +195,7 @@ if (i22.replace(/\S+/g, "") !== o22) {
}
var i23 = "";
for (var j = 23552; j < 24576; j++)
for (var j = 0x5C00; j < 0x6000; j++)
i23 += String.fromCharCode(j);
var o23 = "";
if (i23.replace(/\S+/g, "") !== o23) {
@ -203,7 +203,7 @@ if (i23.replace(/\S+/g, "") !== o23) {
}
var i24 = "";
for (var j = 24576; j < 25600; j++)
for (var j = 0x6000; j < 0x6400; j++)
i24 += String.fromCharCode(j);
var o24 = "";
if (i24.replace(/\S+/g, "") !== o24) {
@ -211,7 +211,7 @@ if (i24.replace(/\S+/g, "") !== o24) {
}
var i25 = "";
for (var j = 25600; j < 26624; j++)
for (var j = 0x6400; j < 0x6800; j++)
i25 += String.fromCharCode(j);
var o25 = "";
if (i25.replace(/\S+/g, "") !== o25) {
@ -219,7 +219,7 @@ if (i25.replace(/\S+/g, "") !== o25) {
}
var i26 = "";
for (var j = 26624; j < 27648; j++)
for (var j = 0x6800; j < 0x6C00; j++)
i26 += String.fromCharCode(j);
var o26 = "";
if (i26.replace(/\S+/g, "") !== o26) {
@ -227,7 +227,7 @@ if (i26.replace(/\S+/g, "") !== o26) {
}
var i27 = "";
for (var j = 27648; j < 28672; j++)
for (var j = 0x6C00; j < 0x7000; j++)
i27 += String.fromCharCode(j);
var o27 = "";
if (i27.replace(/\S+/g, "") !== o27) {
@ -235,7 +235,7 @@ if (i27.replace(/\S+/g, "") !== o27) {
}
var i28 = "";
for (var j = 28672; j < 29696; j++)
for (var j = 0x7000; j < 0x7400; j++)
i28 += String.fromCharCode(j);
var o28 = "";
if (i28.replace(/\S+/g, "") !== o28) {
@ -243,7 +243,7 @@ if (i28.replace(/\S+/g, "") !== o28) {
}
var i29 = "";
for (var j = 29696; j < 30720; j++)
for (var j = 0x7400; j < 0x7800; j++)
i29 += String.fromCharCode(j);
var o29 = "";
if (i29.replace(/\S+/g, "") !== o29) {
@ -251,7 +251,7 @@ if (i29.replace(/\S+/g, "") !== o29) {
}
var i30 = "";
for (var j = 30720; j < 31744; j++)
for (var j = 0x7800; j < 0x7C00; j++)
i30 += String.fromCharCode(j);
var o30 = "";
if (i30.replace(/\S+/g, "") !== o30) {
@ -259,7 +259,7 @@ if (i30.replace(/\S+/g, "") !== o30) {
}
var i31 = "";
for (var j = 31744; j < 32768; j++)
for (var j = 0x7C00; j < 0x8000; j++)
i31 += String.fromCharCode(j);
var o31 = "";
if (i31.replace(/\S+/g, "") !== o31) {
@ -267,7 +267,7 @@ if (i31.replace(/\S+/g, "") !== o31) {
}
var i32 = "";
for (var j = 32768; j < 33792; j++)
for (var j = 0x8000; j < 0x8400; j++)
i32 += String.fromCharCode(j);
var o32 = "";
if (i32.replace(/\S+/g, "") !== o32) {
@ -275,7 +275,7 @@ if (i32.replace(/\S+/g, "") !== o32) {
}
var i33 = "";
for (var j = 33792; j < 34816; j++)
for (var j = 0x8400; j < 0x8800; j++)
i33 += String.fromCharCode(j);
var o33 = "";
if (i33.replace(/\S+/g, "") !== o33) {
@ -283,7 +283,7 @@ if (i33.replace(/\S+/g, "") !== o33) {
}
var i34 = "";
for (var j = 34816; j < 35840; j++)
for (var j = 0x8800; j < 0x8C00; j++)
i34 += String.fromCharCode(j);
var o34 = "";
if (i34.replace(/\S+/g, "") !== o34) {
@ -291,7 +291,7 @@ if (i34.replace(/\S+/g, "") !== o34) {
}
var i35 = "";
for (var j = 35840; j < 36864; j++)
for (var j = 0x8C00; j < 0x9000; j++)
i35 += String.fromCharCode(j);
var o35 = "";
if (i35.replace(/\S+/g, "") !== o35) {
@ -299,7 +299,7 @@ if (i35.replace(/\S+/g, "") !== o35) {
}
var i36 = "";
for (var j = 36864; j < 37888; j++)
for (var j = 0x9000; j < 0x9400; j++)
i36 += String.fromCharCode(j);
var o36 = "";
if (i36.replace(/\S+/g, "") !== o36) {
@ -307,7 +307,7 @@ if (i36.replace(/\S+/g, "") !== o36) {
}
var i37 = "";
for (var j = 37888; j < 38912; j++)
for (var j = 0x9400; j < 0x9800; j++)
i37 += String.fromCharCode(j);
var o37 = "";
if (i37.replace(/\S+/g, "") !== o37) {
@ -315,7 +315,7 @@ if (i37.replace(/\S+/g, "") !== o37) {
}
var i38 = "";
for (var j = 38912; j < 39936; j++)
for (var j = 0x9800; j < 0x9C00; j++)
i38 += String.fromCharCode(j);
var o38 = "";
if (i38.replace(/\S+/g, "") !== o38) {
@ -323,7 +323,7 @@ if (i38.replace(/\S+/g, "") !== o38) {
}
var i39 = "";
for (var j = 39936; j < 40960; j++)
for (var j = 0x9C00; j < 0xA000; j++)
i39 += String.fromCharCode(j);
var o39 = "";
if (i39.replace(/\S+/g, "") !== o39) {
@ -331,7 +331,7 @@ if (i39.replace(/\S+/g, "") !== o39) {
}
var i40 = "";
for (var j = 40960; j < 41984; j++)
for (var j = 0xA000; j < 0xA400; j++)
i40 += String.fromCharCode(j);
var o40 = "";
if (i40.replace(/\S+/g, "") !== o40) {
@ -339,7 +339,7 @@ if (i40.replace(/\S+/g, "") !== o40) {
}
var i41 = "";
for (var j = 41984; j < 43008; j++)
for (var j = 0xA400; j < 0xA800; j++)
i41 += String.fromCharCode(j);
var o41 = "";
if (i41.replace(/\S+/g, "") !== o41) {
@ -347,7 +347,7 @@ if (i41.replace(/\S+/g, "") !== o41) {
}
var i42 = "";
for (var j = 43008; j < 44032; j++)
for (var j = 0xA800; j < 0xAC00; j++)
i42 += String.fromCharCode(j);
var o42 = "";
if (i42.replace(/\S+/g, "") !== o42) {
@ -355,7 +355,7 @@ if (i42.replace(/\S+/g, "") !== o42) {
}
var i43 = "";
for (var j = 44032; j < 45056; j++)
for (var j = 0xAC00; j < 0xB000; j++)
i43 += String.fromCharCode(j);
var o43 = "";
if (i43.replace(/\S+/g, "") !== o43) {
@ -363,7 +363,7 @@ if (i43.replace(/\S+/g, "") !== o43) {
}
var i44 = "";
for (var j = 45056; j < 46080; j++)
for (var j = 0xB000; j < 0xB400; j++)
i44 += String.fromCharCode(j);
var o44 = "";
if (i44.replace(/\S+/g, "") !== o44) {
@ -371,7 +371,7 @@ if (i44.replace(/\S+/g, "") !== o44) {
}
var i45 = "";
for (var j = 46080; j < 47104; j++)
for (var j = 0xB400; j < 0xB800; j++)
i45 += String.fromCharCode(j);
var o45 = "";
if (i45.replace(/\S+/g, "") !== o45) {
@ -379,7 +379,7 @@ if (i45.replace(/\S+/g, "") !== o45) {
}
var i46 = "";
for (var j = 47104; j < 48128; j++)
for (var j = 0xB800; j < 0xBC00; j++)
i46 += String.fromCharCode(j);
var o46 = "";
if (i46.replace(/\S+/g, "") !== o46) {
@ -387,7 +387,7 @@ if (i46.replace(/\S+/g, "") !== o46) {
}
var i47 = "";
for (var j = 48128; j < 49152; j++)
for (var j = 0xBC00; j < 0xC000; j++)
i47 += String.fromCharCode(j);
var o47 = "";
if (i47.replace(/\S+/g, "") !== o47) {
@ -395,7 +395,7 @@ if (i47.replace(/\S+/g, "") !== o47) {
}
var i48 = "";
for (var j = 49152; j < 50176; j++)
for (var j = 0xC000; j < 0xC400; j++)
i48 += String.fromCharCode(j);
var o48 = "";
if (i48.replace(/\S+/g, "") !== o48) {
@ -403,7 +403,7 @@ if (i48.replace(/\S+/g, "") !== o48) {
}
var i49 = "";
for (var j = 50176; j < 51200; j++)
for (var j = 0xC400; j < 0xC800; j++)
i49 += String.fromCharCode(j);
var o49 = "";
if (i49.replace(/\S+/g, "") !== o49) {
@ -411,7 +411,7 @@ if (i49.replace(/\S+/g, "") !== o49) {
}
var i50 = "";
for (var j = 51200; j < 52224; j++)
for (var j = 0xC800; j < 0xCC00; j++)
i50 += String.fromCharCode(j);
var o50 = "";
if (i50.replace(/\S+/g, "") !== o50) {
@ -419,7 +419,7 @@ if (i50.replace(/\S+/g, "") !== o50) {
}
var i51 = "";
for (var j = 52224; j < 53248; j++)
for (var j = 0xCC00; j < 0xD000; j++)
i51 += String.fromCharCode(j);
var o51 = "";
if (i51.replace(/\S+/g, "") !== o51) {
@ -427,7 +427,7 @@ if (i51.replace(/\S+/g, "") !== o51) {
}
var i52 = "";
for (var j = 53248; j < 54272; j++)
for (var j = 0xD000; j < 0xD400; j++)
i52 += String.fromCharCode(j);
var o52 = "";
if (i52.replace(/\S+/g, "") !== o52) {
@ -435,7 +435,7 @@ if (i52.replace(/\S+/g, "") !== o52) {
}
var i53 = "";
for (var j = 54272; j < 55296; j++)
for (var j = 0xD400; j < 0xD800; j++)
i53 += String.fromCharCode(j);
var o53 = "";
if (i53.replace(/\S+/g, "") !== o53) {
@ -443,7 +443,7 @@ if (i53.replace(/\S+/g, "") !== o53) {
}
var i54 = "";
for (var j = 55296; j < 56320; j++)
for (var j = 0xD800; j < 0xDC00; j++)
i54 += String.fromCharCode(j);
var o54 = "";
if (i54.replace(/\S+/g, "") !== o54) {
@ -451,7 +451,7 @@ if (i54.replace(/\S+/g, "") !== o54) {
}
var i55 = "";
for (var j = 56320; j < 57344; j++)
for (var j = 0xDC00; j < 0xE000; j++)
i55 += String.fromCharCode(j);
var o55 = "";
if (i55.replace(/\S+/g, "") !== o55) {
@ -459,7 +459,7 @@ if (i55.replace(/\S+/g, "") !== o55) {
}
var i56 = "";
for (var j = 57344; j < 58368; j++)
for (var j = 0xE000; j < 0xE400; j++)
i56 += String.fromCharCode(j);
var o56 = "";
if (i56.replace(/\S+/g, "") !== o56) {
@ -467,7 +467,7 @@ if (i56.replace(/\S+/g, "") !== o56) {
}
var i57 = "";
for (var j = 58368; j < 59392; j++)
for (var j = 0xE400; j < 0xE800; j++)
i57 += String.fromCharCode(j);
var o57 = "";
if (i57.replace(/\S+/g, "") !== o57) {
@ -475,7 +475,7 @@ if (i57.replace(/\S+/g, "") !== o57) {
}
var i58 = "";
for (var j = 59392; j < 60416; j++)
for (var j = 0xE800; j < 0xEC00; j++)
i58 += String.fromCharCode(j);
var o58 = "";
if (i58.replace(/\S+/g, "") !== o58) {
@ -483,7 +483,7 @@ if (i58.replace(/\S+/g, "") !== o58) {
}
var i59 = "";
for (var j = 60416; j < 61440; j++)
for (var j = 0xEC00; j < 0xF000; j++)
i59 += String.fromCharCode(j);
var o59 = "";
if (i59.replace(/\S+/g, "") !== o59) {
@ -491,7 +491,7 @@ if (i59.replace(/\S+/g, "") !== o59) {
}
var i60 = "";
for (var j = 61440; j < 62464; j++)
for (var j = 0xF000; j < 0xF400; j++)
i60 += String.fromCharCode(j);
var o60 = "";
if (i60.replace(/\S+/g, "") !== o60) {
@ -499,7 +499,7 @@ if (i60.replace(/\S+/g, "") !== o60) {
}
var i61 = "";
for (var j = 62464; j < 63488; j++)
for (var j = 0xF400; j < 0xF800; j++)
i61 += String.fromCharCode(j);
var o61 = "";
if (i61.replace(/\S+/g, "") !== o61) {
@ -507,7 +507,7 @@ if (i61.replace(/\S+/g, "") !== o61) {
}
var i62 = "";
for (var j = 63488; j < 64512; j++)
for (var j = 0xF800; j < 0xFC00; j++)
i62 += String.fromCharCode(j);
var o62 = "";
if (i62.replace(/\S+/g, "") !== o62) {
@ -515,8 +515,8 @@ if (i62.replace(/\S+/g, "") !== o62) {
}
var i63 = "";
for (var j = 64512; j < 65536; j++) {
if (j===65279) { continue;} //Ignore BOM
for (var j = 0xFC00; j < 0x10000; j++) {
if (j === 0xFEFF) { continue; } //Ignore BOM
i63 += String.fromCharCode(j);
}
var o63 = "";
@ -524,7 +524,7 @@ if (i63.replace(/\S+/g, "") !== o63) {
$ERROR("#63: Error matching character class \S between character fc00 and ffff");
}
var i64 = String.fromCharCode(65279);
var i64 = String.fromCharCode(0xFEFF);
if (i64.replace(/\S/g, "") === "") {
$ERROR("#64: Error matching character class \S for BOM (feff)");
}

View File

@ -0,0 +1,59 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.tolocalelowercase
description: >
Check if String.prototype.toLocaleLowerCase supports conditional mappings defined in SpecialCasings,
test Final_Sigma context with Mongolian Vowel Separator
info: >
The result must be derived according to the locale-insensitive case mappings in the Unicode Character
Database (this explicitly includes not only the UnicodeData.txt file, but also all locale-insensitive
mappings in the SpecialCasings.txt file that accompanies it).
---*/
// SpecialCasing.txt, conditional, language-insensitive mappings.
// <code>; <lower>; <title>; <upper>; (<condition_list>;)? # <comment>
// 03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA
// 03A3; 03C3; 03A3; 03A3; # GREEK CAPITAL LETTER SIGMA
// Final_Sigma is defined in Unicode 8.0, 3.13 Default Case Algorithms
// General_Category of Mongolian Vowel Separator is Cf (Format), characters in Cf are Case_Ignorable.
// Sigma preceded by Mongolian Vowel Separator.
assert.sameValue(
"A\u180E\u03A3".toLocaleLowerCase(),
"a\u180E\u03C2",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR"
);
assert.sameValue(
"A\u180E\u03A3B".toLocaleLowerCase(),
"a\u180E\u03C3b",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by LATIN CAPITAL LETTER B"
);
// Sigma followed by Mongolian Vowel Separator.
assert.sameValue(
"A\u03A3\u180E".toLocaleLowerCase(),
"a\u03C2\u180E",
"Sigma preceded by LATIN CAPITAL LETTER A, followed by MONGOLIAN VOWEL SEPARATOR"
);
assert.sameValue(
"A\u03A3\u180EB".toLocaleLowerCase(),
"a\u03C3\u180Eb",
"Sigma preceded by LATIN CAPITAL LETTER A, followed by MONGOLIAN VOWEL SEPARATOR, LATIN CAPITAL LETTER B"
);
// Sigma preceded and followed by Mongolian Vowel Separator.
assert.sameValue(
"A\u180E\u03A3\u180E".toLocaleLowerCase(),
"a\u180E\u03C2\u180E",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by MONGOLIAN VOWEL SEPARATOR"
);
assert.sameValue(
"A\u180E\u03A3\u180EB".toLocaleLowerCase(),
"a\u180E\u03C3\u180Eb",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by MONGOLIAN VOWEL SEPARATOR, LATIN CAPITAL LETTER B"
);

View File

@ -0,0 +1,59 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-string.prototype.tolowercase
description: >
Check if String.prototype.toLowerCase supports conditional mappings defined in SpecialCasings,
test Final_Sigma context with Mongolian Vowel Separator
info: >
The result must be derived according to the locale-insensitive case mappings in the Unicode Character
Database (this explicitly includes not only the UnicodeData.txt file, but also all locale-insensitive
mappings in the SpecialCasings.txt file that accompanies it).
---*/
// SpecialCasing.txt, conditional, language-insensitive mappings.
// <code>; <lower>; <title>; <upper>; (<condition_list>;)? # <comment>
// 03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA
// 03A3; 03C3; 03A3; 03A3; # GREEK CAPITAL LETTER SIGMA
// Final_Sigma is defined in Unicode 8.0, 3.13 Default Case Algorithms
// General_Category of Mongolian Vowel Separator is Cf (Format), characters in Cf are Case_Ignorable.
// Sigma preceded by Mongolian Vowel Separator.
assert.sameValue(
"A\u180E\u03A3".toLowerCase(),
"a\u180E\u03C2",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR"
);
assert.sameValue(
"A\u180E\u03A3B".toLowerCase(),
"a\u180E\u03C3b",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by LATIN CAPITAL LETTER B"
);
// Sigma followed by Mongolian Vowel Separator.
assert.sameValue(
"A\u03A3\u180E".toLowerCase(),
"a\u03C2\u180E",
"Sigma preceded by LATIN CAPITAL LETTER A, followed by MONGOLIAN VOWEL SEPARATOR"
);
assert.sameValue(
"A\u03A3\u180EB".toLowerCase(),
"a\u03C3\u180Eb",
"Sigma preceded by LATIN CAPITAL LETTER A, followed by MONGOLIAN VOWEL SEPARATOR, LATIN CAPITAL LETTER B"
);
// Sigma preceded and followed by Mongolian Vowel Separator.
assert.sameValue(
"A\u180E\u03A3\u180E".toLowerCase(),
"a\u180E\u03C2\u180E",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by MONGOLIAN VOWEL SEPARATOR"
);
assert.sameValue(
"A\u180E\u03A3\u180EB".toLowerCase(),
"a\u180E\u03C3\u180Eb",
"Sigma preceded by LATIN CAPITAL LETTER A, MONGOLIAN VOWEL SEPARATOR, followed by MONGOLIAN VOWEL SEPARATOR, LATIN CAPITAL LETTER B"
);

View File

@ -6,6 +6,6 @@ es5id: 15.5.4.20-3-2
description: String.prototype.trim - 'S' is a string with all WhiteSpace
---*/
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
assert.sameValue(whiteSpacesStr.trim(), "", 'whiteSpacesStr.trim()');

View File

@ -8,8 +8,8 @@ description: >
WhiteSpace and LineTerminator
---*/
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = whiteSpacesStr + lineTerminatorsStr;
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = whiteSpacesStr + lineTerminatorsStr;
assert.sameValue(str.trim(), "", 'str.trim()');

View File

@ -8,8 +8,8 @@ description: >
LineTerminator and all WhiteSpace
---*/
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = whiteSpacesStr + lineTerminatorsStr + "abc";
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = whiteSpacesStr + lineTerminatorsStr + "abc";
assert.sameValue(str.trim(), "abc", 'str.trim()');

View File

@ -8,8 +8,8 @@ description: >
LineTerminator and all WhiteSpace
---*/
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = "abc" + whiteSpacesStr + lineTerminatorsStr ;
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = "abc" + whiteSpacesStr + lineTerminatorsStr ;
assert.sameValue(str.trim(), "abc", 'str.trim()');

View File

@ -9,8 +9,8 @@ description: >
LineTerminator and all WhiteSpace
---*/
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = whiteSpacesStr + lineTerminatorsStr + "abc" + whiteSpacesStr + lineTerminatorsStr;
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = whiteSpacesStr + lineTerminatorsStr + "abc" + whiteSpacesStr + lineTerminatorsStr;
assert.sameValue(str.trim(), "abc", 'str.trim()');

View File

@ -8,8 +8,8 @@ description: >
LineTerminator and WhiteSpace in the middle
---*/
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = "ab" + whiteSpacesStr + lineTerminatorsStr + "cd";
var lineTerminatorsStr = "\u000A\u000D\u2028\u2029";
var whiteSpacesStr = "\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
var str = "ab" + whiteSpacesStr + lineTerminatorsStr + "cd";
assert.sameValue(str.trim(), str, 'str.trim()');

View File

@ -0,0 +1,17 @@
// Copyright (C) 2016 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-white-space
description: >
U+180E is no longer a Unicode `Space_Separator` symbol as of Unicode v6.3.0.
info: >
String.prototype.trim ( )
3. [...] The definition of white space is the union of |WhiteSpace| and
|LineTerminator|.
---*/
assert.sameValue("_\u180E".trim(), "_\u180E");
assert.sameValue("\u180E".trim(), "\u180E");
assert.sameValue("\u180E_".trim(), "\u180E_");

View File

@ -11,8 +11,8 @@ description: "StrWhiteSpaceChar :: USP"
var n;
var count = 0;
var errorCount = 0;
var uspU = ["\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"];
var uspS = ["1680", "180E", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"];
var uspU = ["\u1680", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"];
var uspS = ["1680", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"];
for (var index = 0; index < uspU.length; index++) {
var result = true;
n = false;
@ -35,6 +35,6 @@ for (var index = 0; index < uspU.length; index++) {
count++;
}
if (errorCount > 0) {
if (errorCount > 0) {
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count);
}

View File

@ -0,0 +1,27 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-parsefloat-string
description: >
Leading U+180E is not recognized as whitespace
info: >
18.2.4 parseFloat (string)
...
3. Let trimmedString be a substring of inputString consisting of the
leftmost code unit that is not a StrWhiteSpaceChar and all code units
to the right of that code unit. (In other words, remove leading white
space.) If inputString does not contain any such code units, let
trimmedString be the empty string.
4. If neither trimmedString nor any prefix of trimmedString satisfies the
syntax of a StrDecimalLiteral (see 7.1.3.1), return NaN.
...
---*/
var mongolianVowelSeparator = "\u180E";
assert.sameValue(parseFloat(mongolianVowelSeparator + "1.1"), NaN, "Single leading U+180E");
assert.sameValue(parseFloat(mongolianVowelSeparator + mongolianVowelSeparator + mongolianVowelSeparator + "1.1"), NaN, "Multiple leading U+180E");
assert.sameValue(parseFloat(mongolianVowelSeparator), NaN, "Only U+180E");

View File

@ -11,8 +11,8 @@ description: "StrWhiteSpaceChar :: USP"
var n;
var count = 0;
var errorCount = 0;
var uspU = ["\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"];
var uspS = ["1680", "180E", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"];
var uspU = ["\u1680", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"];
var uspS = ["1680", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"];
for (var index = 0; index < uspU.length; index++) {
var result = true;
@ -36,6 +36,6 @@ for (var index = 0; index < uspU.length; index++) {
count++;
}
if (errorCount > 0) {
if (errorCount > 0) {
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count);
}

View File

@ -0,0 +1,29 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-parseint-string-radix
description: >
Leading U+180E is not recognized as whitespace
info: >
18.2.5 parseInt (string , radix)
...
3. Let S be a newly created substring of inputString consisting of the
first code unit that is not a StrWhiteSpaceChar and all code units
following that code unit. (In other words, remove leading white
space.) If inputString does not contain any such code unit, let S
be the empty string
...
13. If S contains a code unit that is not a radix-R digit, let Z be
the substring of S consisting of all code units before the first
such code unit; otherwise, let Z be S.
14. If Z is empty, return NaN.
...
---*/
var mongolianVowelSeparator = "\u180E";
assert.sameValue(parseInt(mongolianVowelSeparator + "1"), NaN, "Single leading U+180E");
assert.sameValue(parseInt(mongolianVowelSeparator + mongolianVowelSeparator + mongolianVowelSeparator + "1"), NaN, "Multiple leading U+180E");
assert.sameValue(parseInt(mongolianVowelSeparator), NaN, "Only U+180E");

View File

@ -0,0 +1,25 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in multi-line comments.
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
// U+180E in comments; UTF8(0x180E) = 0xE1 0xA0 0x8E
assert.sameValue(
0, /* multi-line comment with U+180E */
0
);

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in single-line comments (eval code).
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
assert.sameValue(eval("0 //\u180E"), 0);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in single-line comments.
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
// U+180E in comments; UTF8(0x180E) = 0xE1 0xA0 0x8E
assert.sameValue(
0, // single-line comment with U+180E
0
);

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in template literals (eval code).
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
assert.sameValue(eval("`\u180E`"), "\u180E");

View File

@ -0,0 +1,22 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in template literals.
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
// U+180E in template literals; UTF8(0x180E) = 0xE1 0xA0 0x8E
assert.sameValue(``, "\u180E");

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in regular expression literals (eval code).
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
assert.sameValue(eval("/\u180E/").source, "\u180E");

View File

@ -0,0 +1,22 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in regular expression literals.
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
// U+180E in regular expressions; UTF8(0x180E) = 0xE1 0xA0 0x8E
assert.sameValue(//.source, "\u180E");

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in string literals (eval code).
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
assert.sameValue(eval("'\u180E'"), "\u180E");

View File

@ -0,0 +1,22 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-unicode-format-control-characters
description: >
Mongolian Vowel Separator can appear in string literals.
info: >
11.1 Unicode Format-Control Characters
The Unicode format-control characters (i.e., the characters in category Cf
in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT
MARK) are control codes used to control the formatting of a range of text in
the absence of higher-level protocols for this (such as mark-up languages).
It is useful to allow format-control characters in source text to facilitate
editing and display. All format control characters may be used within comments,
and within string literals, template literals, and regular expression literals.
---*/
// U+180E in strings; UTF8(0x180E) = 0xE1 0xA0 0x8E
assert.sameValue("", "\u180E");

View File

@ -0,0 +1,28 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-white-space
description: >
Mongolian Vowel Separator is not recognized as white space (eval code).
info: >
11.2 White Space
WhiteSpace ::
<TAB>
<VT>
<FF>
<SP>
<NBSP>
<ZWNBSP>
<USP>
<USP> ::
Other category Zs code points
General Category of U+180E is Cf (Format).
---*/
// U+180E between "var" and "foo".
assert.throws(SyntaxError, function() {
eval("var\u180Efoo;");
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-white-space
description: >
Mongolian Vowel Separator is not recognized as white space.
info: >
11.2 White Space
WhiteSpace ::
<TAB>
<VT>
<FF>
<SP>
<NBSP>
<ZWNBSP>
<USP>
<USP> ::
Other category Zs code points
General Category of U+180E is Cf (Format).
negative: SyntaxError
---*/
// U+180E between "var" and "foo"; UTF8(0x180E) = 0xE1 0xA0 0x8E
varfoo;