1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/collections/Array-of-surfaces.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,14 @@ 1.4 +// Check superficial features of Array.of. 1.5 + 1.6 +load(libdir + "asserts.js"); 1.7 + 1.8 +var desc = Object.getOwnPropertyDescriptor(Array, "of"); 1.9 +assertEq(desc.configurable, true); 1.10 +assertEq(desc.enumerable, false); 1.11 +assertEq(desc.writable, true); 1.12 +assertEq(Array.of.length, 0); 1.13 +assertThrowsInstanceOf(() => new Array.of(), TypeError); // not a constructor 1.14 + 1.15 +// When the this-value passed in is not a constructor, the result is an array. 1.16 +for (let v of [undefined, null, false, "cow"]) 1.17 + assertEq(Array.isArray(Array.of.call(v)), true);