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

Unified Diff: test/mjsunit/harmony/array-concat.js

Issue 799803003: Fix ArrayConcat for JSValues/JSFunctions/JSRegExps with @@isConcatSpreadable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
« src/runtime/runtime-array.cc ('K') | « src/runtime/runtime-strings.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/array-concat.js
diff --git a/test/mjsunit/harmony/array-concat.js b/test/mjsunit/harmony/array-concat.js
index d39998d07f6b4b615eabdfef78ddc2c9d1c1f98b..6175989f3ac19026a8453b14ccd0bd4b799c4cf5 100644
--- a/test/mjsunit/harmony/array-concat.js
+++ b/test/mjsunit/harmony/array-concat.js
@@ -304,6 +304,22 @@ function testConcatTypedArray(type, elems, modulo) {
})();
+(function testConcatSpreadableStringPrototype() {
+ var str1 = new String("yuck\uD83D\uDCA9")
+ // String wrapper objects are not concat-spreadable by default
+ assertEquals([str1], [].concat(str1));
+
+ String.prototype[Symbol.isConcatSpreadable] = true;
+ // String wrapper objects may be concat-spreadable
+ assertEquals(["y", "u", "c", "k", "\uD83D", "\uDCA9"],
+ [].concat(new String("yuck\uD83D\uDCA9")));
+
+ // String values are never concat-spreadable
+ assertEquals(["yuck\uD83D\uDCA9"], [].concat("yuck\uD83D\uDCA9"));
+ delete String.prototype[Symbol.isConcatSpreadable];
+})();
+
+
// ES5 tests
(function testArrayConcatES5() {
"use strict";
« src/runtime/runtime-array.cc ('K') | « src/runtime/runtime-strings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698