Index: test/mjsunit/harmony/array-concat.js |
diff --git a/test/mjsunit/harmony/array-concat.js b/test/mjsunit/harmony/array-concat.js |
index c1ff92c8c3df03100571eafb0f91dd2ad1abbcec..b623a5cc114303a50a39f25e39bb40a6053e1459 100644 |
--- a/test/mjsunit/harmony/array-concat.js |
+++ b/test/mjsunit/harmony/array-concat.js |
@@ -194,6 +194,15 @@ assertThrows(function() { |
(function testConcatArraySubclass() { |
"use strict"; |
+ // If @@isConcatSpreadable is not used, the value of IsArray(O) |
+ // is used to determine the spreadable property. |
+ class A extends Array {} |
+ var obj = [].concat(new A(1, 2, 3), new A(4, 5, 6), new A(7, 8, 9)); |
+ assertEquals(9, obj.length); |
+ for (var i = 0; i < obj.length; ++i) { |
+ assertEquals(i + 1, obj[i]); |
+ } |
+ |
// TODO(caitp): when concat is called on instances of classes which extend |
// Array, they should: |
// |
@@ -203,6 +212,19 @@ assertThrows(function() { |
})(); |
+(function testConcatArraySubclassOptOut() { |
+ "use strict"; |
+ class A extends Array { |
+ get [Symbol.isConcatSpreadable]() { return false; } |
+ } |
+ var obj = [].concat(new A(1, 2, 3), new A(4, 5, 6), new A(7, 8, 9)); |
+ assertEquals(3, obj.length); |
+ assertEquals(3, obj[0].length); |
+ assertEquals(3, obj[1].length); |
+ assertEquals(3, obj[2].length); |
+})(); |
+ |
+ |
(function testConcatNonArray() { |
"use strict"; |
class NonArray { |