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

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

Issue 851163007: Implement IsConstructor() abstract operation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All raw pointers converted to handles Created 5 years, 11 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/array-from.js ('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-of.js
diff --git a/test/mjsunit/harmony/array-of.js b/test/mjsunit/harmony/array-of.js
index c0a8ed183e597fd538b2b8a52ba983f62a2f0cfd..adf7cb547cdae9eebd9fdec14f01c8d562526e65 100644
--- a/test/mjsunit/harmony/array-of.js
+++ b/test/mjsunit/harmony/array-of.js
@@ -159,6 +159,26 @@ assertEquals(Array.of.length, 0);
assertThrows(function() { new Array.of() }, TypeError); // not a constructor
// When the this-value passed in is not a constructor, the result is an array.
-[undefined, null, false, "cow"].forEach(function(val) {
- assertEquals(Array.isArray(Array.of(val)), true);
+[
+ undefined,
+ null,
+ false,
+ "cow",
+ NaN,
+ 67,
+ Infinity,
+ -Infinity,
+ Math.cos, // builtin functions with no [[Construct]] slot
+ Math.cos.bind(Math) // bound builtin functions with no [[Construct]] slot
+].forEach(function(val) {
+ assertEquals(Array.isArray(Array.of.call(val, val)), true);
});
+
+
+(function testBoundConstructor() {
+ var boundFn = (function() {}).bind(null);
+ var instance = Array.of.call(boundFn, 1, 2, 3);
+ assertEquals(instance.length, 3);
+ assertEquals(instance instanceof boundFn, true);
+ assertEquals(Array.isArray(instance), false);
+})();
« no previous file with comments | « test/mjsunit/harmony/array-from.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698