blob: deaa04adc2238528816477b45c48a3145b45d2be [file] [log] [blame]
Tests for Array.prototype.find
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS [undefined, 0, null, false, ''].find(passUndefined) is undefined
PASS [undefined, 0, null, false, ''].find(passZero) is 0
PASS [undefined, 0, null, false, ''].find(passNull) is null
PASS [undefined, 0, null, false, ''].find(passFalse) is false
PASS [undefined, 0, null, false, ''].find(passEmptyString) is ''
PASS [0, null, false, ''].find(passUndefined) is undefined
PASS [undefined, 0, false, ''].find(passNull) is undefined
PASS [undefined, 0, null, ''].find(passFalse) is undefined
PASS [undefined, 0, null, false].find(passEmptyString) is undefined
PASS [undefined, null, false, ''].find(passZero) is undefined
PASS (new Array(20)).find(passUndefined) is undefined
PASS arrayWithHoles.find(passUndefined) is undefined
PASS arrayWithHoles.find(passZero) is 0
PASS arrayWithHoles.find(passNull) is null
PASS arrayWithHoles.find(passFalse) is false
PASS arrayWithHoles.find(passEmptyString) is ''
PASS toObject([undefined, 0, null, false, '']).find(passUndefined) is undefined
PASS toObject([undefined, 0, null, false, '']).find(passZero) is 0
PASS toObject([undefined, 0, null, false, '']).find(passNull) is null
PASS toObject([undefined, 0, null, false, '']).find(passFalse) is false
PASS toObject([undefined, 0, null, false, '']).find(passEmptyString) is ''
PASS toObject([0, null, false, '']).find(passUndefined) is undefined
PASS toObject([undefined, 0, false, '']).find(passNull) is undefined
PASS toObject([undefined, 0, null, '']).find(passFalse) is undefined
PASS toObject([undefined, 0, null, false]).find(passEmptyString) is undefined
PASS toObject([undefined, null, false, '']).find(passZero) is undefined
PASS toObject(new Array(20)).find(passUndefined) is undefined
PASS [0,1,2,3,4,5,6,7,8,9].find(findItemAddedDuringSearch) is undefined
PASS [0,1,2,3,4,5,6,7,8,9].find(findItemRemovedDuringSearch) is undefined
PASS Array.prototype.find.call(undefined, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be undefined.
PASS Array.prototype.find.call(null, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null.
PASS [].find(1) threw exception TypeError: Array.prototype.find callback must be a function.
PASS [].find('hello') threw exception TypeError: Array.prototype.find callback must be a function.
PASS [].find([]) threw exception TypeError: Array.prototype.find callback must be a function.
PASS [].find({}) threw exception TypeError: Array.prototype.find callback must be a function.
PASS [].find(null) threw exception TypeError: Array.prototype.find callback must be a function.
PASS [].find(undefined) threw exception TypeError: Array.prototype.find callback must be a function.
find callback called with index 10
find callback called with index 20
find callback called with index 30
find callback called with index 40
find callback called with index 50
PASS numberOfCallbacksInFindInArrayWithHoles() is 5
PASS successfullyParsed is true
TEST COMPLETE