haikuwebkit/LayoutTests/js/array-find-expected.txt

67 lines
3.7 KiB
Plaintext
Raw Permalink Normal View History

Tests for Array.prototype.find
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Array.prototype methods must use ToLength https://bugs.webkit.org/show_bug.cgi?id=144128 Reviewed by Oliver Hunt. Source/JavaScriptCore: Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength This patch introduces ToLength and ToInteger JS implementation to encourage the DFG/FTL's inlining. These implementations are located in GlobalObject.js. And set to the JSGlobalObject with the private symbols @ToLength and @ToInteger manually. * builtins/Array.prototype.js: (every): (forEach): (filter): (map): (some): (fill): (find): (findIndex): (includes): * builtins/ArrayConstructor.js: (from): * builtins/GlobalObject.js: Copied from Source/JavaScriptCore/builtins/StringConstructor.js. (ToInteger): (ToLength): * builtins/StringConstructor.js: (raw): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObjectFunctions.h: LayoutTests: * fast/profiler/built-in-function-calls-anonymous-expected.txt: * fast/profiler/built-in-function-calls-user-defined-function-expected.txt: * js/array-every-expected.txt: * js/array-fill-expected.txt: * js/array-filter-expected.txt: * js/array-find-expected.txt: * js/array-findIndex-expected.txt: * js/array-functions-non-arrays-expected.txt: * js/array-includes-expected.txt: * js/script-tests/array-every.js: (throwError): * js/script-tests/array-fill.js: (throwError): * js/script-tests/array-filter.js: (throwError): * js/script-tests/array-find.js: (throwError): * js/script-tests/array-findIndex.js: (toObject): (throwError): * js/script-tests/array-functions-non-arrays.js: (throwError): * js/script-tests/array-includes.js: Canonical link: https://commits.webkit.org/163178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-19 19:51:46 +00:00
PASS Array.prototype.find.length is 1
PASS Array.prototype.find.name is 'find'
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
Array.prototype methods must use ToLength https://bugs.webkit.org/show_bug.cgi?id=144128 Reviewed by Oliver Hunt. Source/JavaScriptCore: Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength This patch introduces ToLength and ToInteger JS implementation to encourage the DFG/FTL's inlining. These implementations are located in GlobalObject.js. And set to the JSGlobalObject with the private symbols @ToLength and @ToInteger manually. * builtins/Array.prototype.js: (every): (forEach): (filter): (map): (some): (fill): (find): (findIndex): (includes): * builtins/ArrayConstructor.js: (from): * builtins/GlobalObject.js: Copied from Source/JavaScriptCore/builtins/StringConstructor.js. (ToInteger): (ToLength): * builtins/StringConstructor.js: (raw): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObjectFunctions.h: LayoutTests: * fast/profiler/built-in-function-calls-anonymous-expected.txt: * fast/profiler/built-in-function-calls-user-defined-function-expected.txt: * js/array-every-expected.txt: * js/array-fill-expected.txt: * js/array-filter-expected.txt: * js/array-find-expected.txt: * js/array-findIndex-expected.txt: * js/array-functions-non-arrays-expected.txt: * js/array-includes-expected.txt: * js/script-tests/array-every.js: (throwError): * js/script-tests/array-fill.js: (throwError): * js/script-tests/array-filter.js: (throwError): * js/script-tests/array-find.js: (throwError): * js/script-tests/array-findIndex.js: (toObject): (throwError): * js/script-tests/array-functions-non-arrays.js: (throwError): * js/script-tests/array-includes.js: Canonical link: https://commits.webkit.org/163178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-19 19:51:46 +00:00
Array with holes
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 ''
Array.prototype methods must use ToLength https://bugs.webkit.org/show_bug.cgi?id=144128 Reviewed by Oliver Hunt. Source/JavaScriptCore: Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength This patch introduces ToLength and ToInteger JS implementation to encourage the DFG/FTL's inlining. These implementations are located in GlobalObject.js. And set to the JSGlobalObject with the private symbols @ToLength and @ToInteger manually. * builtins/Array.prototype.js: (every): (forEach): (filter): (map): (some): (fill): (find): (findIndex): (includes): * builtins/ArrayConstructor.js: (from): * builtins/GlobalObject.js: Copied from Source/JavaScriptCore/builtins/StringConstructor.js. (ToInteger): (ToLength): * builtins/StringConstructor.js: (raw): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObjectFunctions.h: LayoutTests: * fast/profiler/built-in-function-calls-anonymous-expected.txt: * fast/profiler/built-in-function-calls-user-defined-function-expected.txt: * js/array-every-expected.txt: * js/array-fill-expected.txt: * js/array-filter-expected.txt: * js/array-find-expected.txt: * js/array-findIndex-expected.txt: * js/array-functions-non-arrays-expected.txt: * js/array-includes-expected.txt: * js/script-tests/array-every.js: (throwError): * js/script-tests/array-fill.js: (throwError): * js/script-tests/array-filter.js: (throwError): * js/script-tests/array-find.js: (throwError): * js/script-tests/array-findIndex.js: (toObject): (throwError): * js/script-tests/array-functions-non-arrays.js: (throwError): * js/script-tests/array-includes.js: Canonical link: https://commits.webkit.org/163178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-19 19:51:46 +00:00
Generic Object
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
Array.prototype methods must use ToLength https://bugs.webkit.org/show_bug.cgi?id=144128 Reviewed by Oliver Hunt. Source/JavaScriptCore: Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength This patch introduces ToLength and ToInteger JS implementation to encourage the DFG/FTL's inlining. These implementations are located in GlobalObject.js. And set to the JSGlobalObject with the private symbols @ToLength and @ToInteger manually. * builtins/Array.prototype.js: (every): (forEach): (filter): (map): (some): (fill): (find): (findIndex): (includes): * builtins/ArrayConstructor.js: (from): * builtins/GlobalObject.js: Copied from Source/JavaScriptCore/builtins/StringConstructor.js. (ToInteger): (ToLength): * builtins/StringConstructor.js: (raw): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObjectFunctions.h: LayoutTests: * fast/profiler/built-in-function-calls-anonymous-expected.txt: * fast/profiler/built-in-function-calls-user-defined-function-expected.txt: * js/array-every-expected.txt: * js/array-fill-expected.txt: * js/array-filter-expected.txt: * js/array-find-expected.txt: * js/array-findIndex-expected.txt: * js/array-functions-non-arrays-expected.txt: * js/array-includes-expected.txt: * js/script-tests/array-every.js: (throwError): * js/script-tests/array-fill.js: (throwError): * js/script-tests/array-filter.js: (throwError): * js/script-tests/array-find.js: (throwError): * js/script-tests/array-findIndex.js: (toObject): (throwError): * js/script-tests/array-functions-non-arrays.js: (throwError): * js/script-tests/array-includes.js: Canonical link: https://commits.webkit.org/163178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-19 19:51:46 +00:00
Array-like object with invalid lengths
PASS var obj = { 0: 1, 1: 2, 2: 3, length: 0 }; Array.prototype.find.call(obj, throwError) is undefined.
PASS var obj = { 0: 1, 1: 2, 2: 3, length: -0 }; Array.prototype.find.call(obj, throwError) is undefined.
PASS var obj = { 0: 1, 1: 2, 2: 3, length: -3 }; Array.prototype.find.call(obj, throwError) is undefined.
Modification during search
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
Array.prototype methods must use ToLength https://bugs.webkit.org/show_bug.cgi?id=144128 Reviewed by Oliver Hunt. Source/JavaScriptCore: Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength This patch introduces ToLength and ToInteger JS implementation to encourage the DFG/FTL's inlining. These implementations are located in GlobalObject.js. And set to the JSGlobalObject with the private symbols @ToLength and @ToInteger manually. * builtins/Array.prototype.js: (every): (forEach): (filter): (map): (some): (fill): (find): (findIndex): (includes): * builtins/ArrayConstructor.js: (from): * builtins/GlobalObject.js: Copied from Source/JavaScriptCore/builtins/StringConstructor.js. (ToInteger): (ToLength): * builtins/StringConstructor.js: (raw): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObjectFunctions.h: LayoutTests: * fast/profiler/built-in-function-calls-anonymous-expected.txt: * fast/profiler/built-in-function-calls-user-defined-function-expected.txt: * js/array-every-expected.txt: * js/array-fill-expected.txt: * js/array-filter-expected.txt: * js/array-find-expected.txt: * js/array-findIndex-expected.txt: * js/array-functions-non-arrays-expected.txt: * js/array-includes-expected.txt: * js/script-tests/array-every.js: (throwError): * js/script-tests/array-fill.js: (throwError): * js/script-tests/array-filter.js: (throwError): * js/script-tests/array-find.js: (throwError): * js/script-tests/array-findIndex.js: (toObject): (throwError): * js/script-tests/array-functions-non-arrays.js: (throwError): * js/script-tests/array-includes.js: Canonical link: https://commits.webkit.org/163178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-19 19:51:46 +00:00
Exceptions
Make builtin TypeErrors consistent https://bugs.webkit.org/show_bug.cgi?id=159899 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-07-18 Reviewed by Keith Miller. Source/JavaScriptCore: Converge on the single TypeError for non-coercible this objects in builtins. Also update some other style to be more consistent with-in builtins. * builtins/ArrayIteratorPrototype.js: (next): * builtins/ArrayPrototype.js: (values): (keys): (entries): (reduce): (reduceRight): (every): (forEach): (filter): (map): (some): (fill): (find): (findIndex): (includes): (sort): (concatSlowPath): (copyWithin): * builtins/StringPrototype.js: (match): (repeat): (padStart): (padEnd): (intrinsic.StringPrototypeReplaceIntrinsic.replace): (localeCompare): (search): (split): * tests/es6/String.prototype_methods_String.prototype.padEnd.js: * tests/es6/String.prototype_methods_String.prototype.padStart.js: * tests/stress/array-iterators-next-error-messages.js: (catch): * tests/stress/array-iterators-next-with-call.js: * tests/stress/regexp-match.js: (shouldThrow): * tests/stress/regexp-search.js: (shouldThrow): LayoutTests: * js/array-find-expected.txt: * js/array-findIndex-expected.txt: * js/array-includes-expected.txt: * js/dom/array-prototype-properties-expected.txt: * js/dom/script-tests/string-prototype-properties.js: * js/dom/string-prototype-properties-expected.txt: * js/script-tests/array-find.js: * js/script-tests/array-findIndex.js: * js/script-tests/string-localeCompare.js: * js/string-localeCompare-expected.txt: * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.10_String.prototype.match/S15.5.4.10_A1_T3-expected.txt: * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.11_String.prototype.replace/S15.5.4.11_A1_T3-expected.txt: * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.12_String.prototype.search/S15.5.4.12_A1_T3-expected.txt: * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.14_String.prototype.split/S15.5.4.14_A1_T3-expected.txt: Canonical link: https://commits.webkit.org/178077@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-19 02:45:35 +00:00
PASS Array.prototype.find.call(undefined, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null or undefined.
PASS Array.prototype.find.call(null, function() {}) threw exception TypeError: Array.prototype.find requires that |this| not be null or undefined.
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.
Callbacks in the expected order and *not* skipping holes
find callback called with index 0
find callback called with index 1
find callback called with index 2
find callback called with index 3
find callback called with index 4
find callback called with index 5
find callback called with index 6
find callback called with index 7
PASS numberOfCallbacksInFindInArrayWithHoles() is 8
PASS successfullyParsed is true
TEST COMPLETE