62 lines
2.7 KiB
Plaintext
62 lines
2.7 KiB
Plaintext
This test checks the behavior of the every() method on Array objects.
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
PASS Array.prototype.every.length is 1
|
|
PASS Array.prototype.every.name is 'every'
|
|
|
|
1.0 Single Argument Testing
|
|
PASS [12, 5, 8, 130, 44].every(isBigEnough) is false
|
|
PASS [12, 54, 18, 130, 44].every(isBigEnough) is true
|
|
|
|
2.0 Two Argument Testing
|
|
PASS [12, 5, 10, 130, 44].every(isBigEnough, predicate) is false
|
|
PASS [12, 54, 18, 130, 44].every(isBigEnough, predicate) is true
|
|
|
|
3.0 Array Mutation Tests
|
|
|
|
3.1 Array Element Removal
|
|
PASS [12, 5, 8, 130, 44].every(isBigEnoughAndPop) is false
|
|
PASS [12, 54, 18, 130, 44].every(isBigEnoughAndPop) is true
|
|
|
|
3.2 Array Element Changing
|
|
PASS [12, 5, 8, 130, 44].every(isBigEnoughAndChange) is false
|
|
PASS [12, 54, 18, 130, 44].every(isBigEnoughAndChange) is false
|
|
|
|
3.3 Array Element Addition
|
|
PASS [12, 5, 8, 130, 44].every(isBigEnoughAndPush) is false
|
|
PASS [12, 54, 18, 130, 44].every(isBigEnoughAndPush) is false
|
|
|
|
4.0 Exception Test
|
|
PASS [12, 5, 8, 130, 44].every(isBigEnoughAndException) threw exception exception from function.
|
|
PASS [12, 54, 18, 130, 44].every(isBigEnoughAndException) threw exception exception from function.
|
|
|
|
5.0 Wrong Type for Callback Test
|
|
PASS [12, 5, 8, 130, 44].every(5) threw exception TypeError: Array.prototype.every callback must be a function.
|
|
PASS [12, 5, 8, 130, 44].every('wrong') threw exception TypeError: Array.prototype.every callback must be a function.
|
|
PASS [12, 5, 8, 130, 44].every(new Object()) threw exception TypeError: Array.prototype.every callback must be a function.
|
|
PASS [12, 5, 8, 130, 44].every(null) threw exception TypeError: Array.prototype.every callback must be a function.
|
|
PASS [12, 5, 8, 130, 44].every(undefined) threw exception TypeError: Array.prototype.every callback must be a function.
|
|
PASS [12, 5, 8, 130, 44].every() threw exception TypeError: Array.prototype.every callback must be a function.
|
|
|
|
6.0 Early Exit ("Short Circuiting")
|
|
PASS [12, 5, 8, 130, 44].every(isBigEnoughShortCircuit) is false
|
|
PASS accumulator.toString() is [12, 5].toString()
|
|
PASS [12, 54, 18, 130, 44].every(isBigEnoughShortCircuit) is true
|
|
PASS accumulator.toString() is [12, 54, 18, 130, 44].toString()
|
|
|
|
7.0 Behavior for Holes in Arrays
|
|
PASS arr.every(isNotUndefined) is true
|
|
PASS arr.every(isNotUndefined) is true
|
|
|
|
8.0 Array-like object with invalid lengths
|
|
PASS var obj = { 0: 1, 1: 2, 2: 3, length: 0 }; Array.prototype.every.call(obj, throwError) is true
|
|
PASS var obj = { 0: 1, 1: 2, 2: 3, length: -0 }; Array.prototype.every.call(obj, throwError) is true
|
|
PASS var obj = { 0: 1, 1: 2, 2: 3, length: -3 }; Array.prototype.every.call(obj, throwError) is true
|
|
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|