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

Unified Diff: test/mjsunit/harmony/typedarray-tostring.js

Issue 1215863003: Include Harmony Array/TypedArray methods unconditionally (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove the flag and move the tests Created 5 years, 6 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
« no previous file with comments | « test/mjsunit/harmony/typedarray-sort.js ('k') | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/typedarray-tostring.js
diff --git a/test/mjsunit/harmony/typedarray-tostring.js b/test/mjsunit/harmony/typedarray-tostring.js
deleted file mode 100644
index e3591d819d3e5d0785c027dd9e7e0ee7aeb7014e..0000000000000000000000000000000000000000
--- a/test/mjsunit/harmony/typedarray-tostring.js
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2015 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-arrays
-
-// Array's toString should call the object's own join method, if one exists and
-// is callable. Otherwise, just use the original Object.toString function.
-
-var typedArrayConstructors = [
- Uint8Array,
- Int8Array,
- Uint16Array,
- Int16Array,
- Uint32Array,
- Int32Array,
- Uint8ClampedArray,
- Float32Array,
- Float64Array
-];
-
-for (var constructor of typedArrayConstructors) {
- var success = "[test success]";
- var expectedThis;
- function testJoin() {
- assertEquals(0, arguments.length);
- assertSame(expectedThis, this);
- return success;
- }
-
-
- // On an Array object.
-
- // Default case.
- var a1 = new constructor([1, 2, 3]);
- assertEquals("1,2,3", a1.toString());
- assertEquals("1,2,3", a1.join());
- assertEquals("1,2,3", a1.toLocaleString());
-
- // Non-standard "join" function is called correctly.
- var a2 = new constructor([1, 2, 3]);
- a2.join = testJoin;
- expectedThis = a2;
- assertEquals(success, a2.toString());
- assertEquals(success, a2.join());
- assertEquals("1,2,3", a2.toLocaleString());
-
- // Non-callable join function is ignored and Object.prototype.toString is
- // used instead.
- var a3 = new constructor([1, 2, 3]);
- a3.join = "not callable";
- assertEquals(0, a3.toString().search(/\[object .+Array\]/));
-
- // Non-existing join function is treated same as non-callable.
- var a4 = new constructor([1, 2, 3]);
- a4.__proto__ = { toString: constructor.prototype.toString };
- // No join on Array.
- assertEquals(0, a3.toString().search(/\[object .+Array\]/));
-
-
- // On a non-Array object, throws.
- var o1 = {length: 3, 0: 1, 1: 2, 2: 3,
- toString: constructor.prototype.toString,
- join: constructor.prototype.join,
- toLocaleString: constructor.prototype.toLocaleString};
- assertThrows(function() { o1.join() }, TypeError);
- assertThrows(function() { o1.toString() }, TypeError);
- assertThrows(function() { o1.toLocaleString() }, TypeError);
- // toString is OK if join not from here:
- o1.join = Array.prototype.join;
- assertEquals("1,2,3", o1.join());
- assertEquals("1,2,3", o1.toString());
- assertThrows(function() { o1.toLocaleString() }, TypeError);
- // TODO(littledan): Use the same function for TypedArray as for
- // Array, as the spec says (but Firefox doesn't do either).
- // Currently, using the same method leads to a bootstrap failure.
- // assertEquals(o1.toString, Array.prototype.toString);
-
- // Redefining length does not change result
- var a5 = new constructor([1, 2, 3])
- Object.defineProperty(a5, 'length', { value: 2 });
- assertEquals("1,2,3", a5.join());
- assertEquals("1,2,3", a5.toString());
- assertEquals("1,2,3", a5.toLocaleString());
- assertEquals("1,2", Array.prototype.join.call(a5));
- assertEquals("1,2,3", Array.prototype.toString.call(a5));
- assertEquals("1,2", Array.prototype.toLocaleString.call(a5));
-}
« no previous file with comments | « test/mjsunit/harmony/typedarray-sort.js ('k') | test/mjsunit/harmony/typedarrays.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698