Home | History | Annotate | Download | only in es6

Lines Matching refs:Array

5 // Based on Mozilla Array.of() tests at http://dxr.mozilla.org/mozilla-central/source/js/src/jit-test/tests/collections
9 // Array.of makes real arrays.
12 assertEquals(Object.getPrototypeOf(a), Array.prototype);
13 assertEquals(Array.isArray(a), true);
19 check(Array.of());
20 check(Array.of(0));
21 check(Array.of(0, 1, 2));
22 var f = Array.of;
26 // Array.of basics
28 var a = Array.of();
31 a = Array.of(undefined, null, 3.14, []);
36 assertEquals(Array.of.apply(null, a), a);
39 // Array.of does not leave holes
41 assertEquals(Array.of(undefined), [undefined]);
42 assertEquals(Array.of(undefined, undefined), [undefined, undefined]);
43 assertEquals(Array.of.apply(null, [,,undefined]), [undefined, undefined, undefined]);
44 assertEquals(Array.of.apply(null, Array(4)), [undefined, undefined, undefined, undefined]);
47 // Array.of can be transplanted to other classes.
53 Bag.of = Array.of;
67 actual = Array.of.call(Bag, "zero", "one");
71 function areSame(object, array) {
72 var result = object.length == array.length;
74 result = result && object[i] == array[i];
80 // Array.of does not trigger prototype setters.
84 Object.defineProperty(Array.prototype, "0", {set: function(v) {status = "FAIL 1"}});
85 assertEquals(Array.of(1)[0], 1);
93 // Array.of passes the number of arguments to the constructor it calls.
103 Herd.of = Array.of;
108 // Array.of calls a "length" setter if one is present.
122 Pack.of = Array.of;
130 Bevy.of = Array.of;
136 // Array.of does a strict assignment to the new object's .length.
140 Empty.of = Array.of;
149 // Check superficial features of Array.of.
151 var desc = Object.getOwnPropertyDescriptor(Array, "of");
156 assertEquals(Array.of.length, 0);
157 assertThrows(function() { new Array.of() }, TypeError); // not a constructor
159 // When the this-value passed in is not a constructor, the result is an array.
172 assertEquals(Array.isArray(Array.of.call(val, val)), true);
178 var instance = Array.of.call(boundFn, 1, 2, 3);
181 assertEquals(Array.isArray(instance), false);
195 assertThrows(function () { Array.of.call(exotic, 1); }, TypeError);
199 // Check that array properties defined are writable, enumerable, configurable
201 var x = Array.of.call(ordinary, 2);