34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
Tests for Array.of
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
PASS Array.of.length is 0
|
|
PASS Array.of.name is 'of'
|
|
PASS Array.of(1) is [1]
|
|
PASS Array.of(1, 2) is [1, 2]
|
|
PASS Array.of(1, 2, 3) is [1, 2, 3]
|
|
PASS Array.of() is []
|
|
PASS Array.of(undefined) is [undefined]
|
|
PASS Array.of('hello') is ['hello']
|
|
Construct nested Array with Array.of(Array.of(1, 2, 3), Array.of(4, 5, 6, 7, 8)).
|
|
PASS x.length is 2
|
|
PASS x[0].length is 3
|
|
PASS x[1].length is 5
|
|
Check that a setter isn't called.
|
|
PASS Array.of(1, 2, 3) did not throw exception.
|
|
"this" is a constructor
|
|
PASS Array.of.call(Foo, 'a', 'b', 'c') instanceof Foo is true
|
|
PASS Array.of.call(Foo, 'a', 'b', 'c').givenLength is 3
|
|
PASS var foo = Array.of.call(Foo, 'a', 'b', 'c'); [foo.length, foo[0], foo[1], foo[2]] is [3, 'a', 'b', 'c']
|
|
"this" is not a constructor
|
|
PASS Array.of.call(nonConstructor, Foo).constructor is Array
|
|
PASS Object.getPrototypeOf(Array.of.call(nonConstructor, Foo)) is Array.prototype
|
|
PASS Array.of.call(nonConstructor, Foo).length is 1
|
|
PASS Array.of.call(nonConstructor, Foo)[0] is Foo
|
|
PASS nonConstructorWasCalled is false
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|