Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1760)

Unified Diff: test/intl/general/smp-identifier.js

Issue 640193002: Allow identifier code points from supplementary multilingual planes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: parser fix Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/intl/general/smp-identifier.js
diff --git a/test/intl/general/smp-identifier.js b/test/intl/general/smp-identifier.js
new file mode 100644
index 0000000000000000000000000000000000000000..55afd0f7894fd696664a0962d59a910bd6956b75
--- /dev/null
+++ b/test/intl/general/smp-identifier.js
@@ -0,0 +1,45 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-strings
+
+function toSurrogatePair(c) {
+ return String.fromCharCode(((c - 0x10000) >>> 10) & 0x3FF | 0xD800) +
+ String.fromCharCode(c & 0x3FF | 0xDC00);
mathias 2014/10/09 14:45:42 Since `--harmony-strings` is set anyway, why not u
Yang 2014/10/09 14:50:18 Apparently flags are not parsed in intl/ tests. I'
+}
+
+function testIdStart(c, is_id_start) {
+ var source = "var " + toSurrogatePair(c);
+ print(source);
+ if (is_id_start) {
+ assertDoesNotThrow(source);
+ } else {
+ assertThrows(source);
+ }
+}
+
+function testIdPart(c, is_id_start) {
+ var source = "var v" + toSurrogatePair(c);
+ print(source);
+ if (is_id_start) {
+ assertDoesNotThrow(source);
+ } else {
+ assertThrows(source);
+ }
+}
+
+[0x10403, 0x1043C, 0x16F9C, 0x10048, 0x1014D].forEach(function(c) {
+ testIdStart(c, true);
+ testIdPart(c, true);
+});
+
+[0x101FD, 0x11002, 0x104A9].forEach(function(c) {
+ testIdStart(c, false);
+ testIdPart(c, true);
+});
+
+[0x10111, 0x1F4A9].forEach(function(c) {
+ testIdStart(c, false);
+ testIdPart(c, false);
+});

Powered by Google App Engine
This is Rietveld 408576698