Changeset 191300 in webkit
- Timestamp:
- Oct 19, 2015, 11:32:30 AM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r191299 r191300 1 2015-10-17 Keith Miller <keith_miller@apple.com> 2 3 Add regression tests for TypedArray.prototype functions' error messages. 4 https://bugs.webkit.org/show_bug.cgi?id=150288 5 6 Reviewed by Darin Adler. 7 8 Fix a typo in the text passed by TypedArrray.prototype.filter type error message. 9 Add tests that check the actual error message text for all the TypeArray.prototype 10 functions that throw. 11 12 * builtins/TypedArray.prototype.js: 13 (filter): 14 * tests/stress/typedarray-every.js: 15 * tests/stress/typedarray-filter.js: 16 * tests/stress/typedarray-find.js: 17 * tests/stress/typedarray-findIndex.js: 18 * tests/stress/typedarray-forEach.js: 19 * tests/stress/typedarray-map.js: 20 * tests/stress/typedarray-reduce.js: 21 * tests/stress/typedarray-reduceRight.js: 22 * tests/stress/typedarray-some.js: 23 1 24 2015-10-19 Tim Horton <timothy_horton@apple.com> 2 25 -
trunk/Source/JavaScriptCore/builtins/TypedArray.prototype.js
r191225 r191300 250 250 251 251 if (typeof callback !== "function") 252 throw new @TypeError(" Array.prototype.filter callback must be a function");252 throw new @TypeError("TypedArray.prototype.filter callback must be a function"); 253 253 254 254 var thisArg = arguments.length > 1 ? arguments[1] : undefined; -
trunk/Source/JavaScriptCore/tests/stress/typedarray-every.js
r190429 r191300 47 47 48 48 debug("5.0 Wrong Type for Callback Test"); 49 shouldThrow("testPrototypeFunction('every', '(8)', [12, 15, 10, 13, 44], false)" );50 shouldThrow("testPrototypeFunction('every', '(\"wrong\")', [12, 15, 10, 13, 44], false)" );51 shouldThrow("testPrototypeFunction('every', '(new Object())', [12, 15, 10, 13, 44], false)" );52 shouldThrow("testPrototypeFunction('every', '(null)', [12, 15, 10, 13, 44], false)" );53 shouldThrow("testPrototypeFunction('every', '()', [12, 15, 10, 13, 44], false)" );49 shouldThrow("testPrototypeFunction('every', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.every callback must be a function'"); 50 shouldThrow("testPrototypeFunction('every', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.every callback must be a function'"); 51 shouldThrow("testPrototypeFunction('every', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.every callback must be a function'"); 52 shouldThrow("testPrototypeFunction('every', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.every callback must be a function'"); 53 shouldThrow("testPrototypeFunction('every', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.every callback must be a function'"); 54 54 debug(""); 55 55 -
trunk/Source/JavaScriptCore/tests/stress/typedarray-filter.js
r190429 r191300 43 43 44 44 debug("5.0 Wrong Type for Callback Test"); 45 shouldThrow("testPrototypeFunction('filter', '(8)', [12, 15, 10, 13, 44], false)" );46 shouldThrow("testPrototypeFunction('filter', '(\"wrong\")', [12, 15, 10, 13, 44], false)" );47 shouldThrow("testPrototypeFunction('filter', '(new Object())', [12, 15, 10, 13, 44], false)" );48 shouldThrow("testPrototypeFunction('filter', '(null)', [12, 15, 10, 13, 44], false)" );49 shouldThrow("testPrototypeFunction('filter', '()', [12, 15, 10, 13, 44], false)" );45 shouldThrow("testPrototypeFunction('filter', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.filter callback must be a function'"); 46 shouldThrow("testPrototypeFunction('filter', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.filter callback must be a function'"); 47 shouldThrow("testPrototypeFunction('filter', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.filter callback must be a function'"); 48 shouldThrow("testPrototypeFunction('filter', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.filter callback must be a function'"); 49 shouldThrow("testPrototypeFunction('filter', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.filter callback must be a function'"); 50 50 debug(""); 51 51 finishJSTest(); -
trunk/Source/JavaScriptCore/tests/stress/typedarray-find.js
r190429 r191300 45 45 46 46 debug("5.0 Wrong Type for Callback Test"); 47 shouldThrow("testPrototypeFunction('find', '(8)', [12, 15, 10, 13, 44], false)" );48 shouldThrow("testPrototypeFunction('find', '(\"wrong\")', [12, 15, 10, 13, 44], false)" );49 shouldThrow("testPrototypeFunction('find', '(new Object())', [12, 15, 10, 13, 44], false)" );50 shouldThrow("testPrototypeFunction('find', '(null)', [12, 15, 10, 13, 44], false)" );51 shouldThrow("testPrototypeFunction('find', '()', [12, 15, 10, 13, 44], false)" );47 shouldThrow("testPrototypeFunction('find', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.find callback must be a function'"); 48 shouldThrow("testPrototypeFunction('find', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.find callback must be a function'"); 49 shouldThrow("testPrototypeFunction('find', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.find callback must be a function'"); 50 shouldThrow("testPrototypeFunction('find', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.find callback must be a function'"); 51 shouldThrow("testPrototypeFunction('find', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.find callback must be a function'"); 52 52 debug(""); 53 53 finishJSTest(); -
trunk/Source/JavaScriptCore/tests/stress/typedarray-findIndex.js
r190429 r191300 45 45 46 46 debug("5.0 Wrong Type for Callback Test"); 47 shouldThrow("testPrototypeFunction('findIndex', '(8)', [12, 15, 10, 13, 44], false)" );48 shouldThrow("testPrototypeFunction('findIndex', '(\"wrong\")', [12, 15, 10, 13, 44], false)" );49 shouldThrow("testPrototypeFunction('findIndex', '(new Object())', [12, 15, 10, 13, 44], false)" );50 shouldThrow("testPrototypeFunction('findIndex', '(null)', [12, 15, 10, 13, 44], false)" );51 shouldThrow("testPrototypeFunction('findIndex', '()', [12, 15, 10, 13, 44], false)" );47 shouldThrow("testPrototypeFunction('findIndex', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findIndex callback must be a function'"); 48 shouldThrow("testPrototypeFunction('findIndex', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findIndex callback must be a function'"); 49 shouldThrow("testPrototypeFunction('findIndex', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findIndex callback must be a function'"); 50 shouldThrow("testPrototypeFunction('findIndex', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findIndex callback must be a function'"); 51 shouldThrow("testPrototypeFunction('findIndex', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.findIndex callback must be a function'"); 52 52 debug(""); 53 53 finishJSTest(); -
trunk/Source/JavaScriptCore/tests/stress/typedarray-forEach.js
r190429 r191300 83 83 84 84 debug("5.0 Wrong Type for Callback Test"); 85 shouldThrow("testPrototypeFunction('forEach', '(8)', [12, 15, 10, 13, 44], false)" );86 shouldThrow("testPrototypeFunction('forEach', '(\"wrong\")', [12, 15, 10, 13, 44], false)" );87 shouldThrow("testPrototypeFunction('forEach', '(new Object())', [12, 15, 10, 13, 44], false)" );88 shouldThrow("testPrototypeFunction('forEach', '(null)', [12, 15, 10, 13, 44], false)" );89 shouldThrow("testPrototypeFunction('forEach', '()', [12, 15, 10, 13, 44], false)" );85 shouldThrow("testPrototypeFunction('forEach', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.forEach callback must be a function'"); 86 shouldThrow("testPrototypeFunction('forEach', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.forEach callback must be a function'"); 87 shouldThrow("testPrototypeFunction('forEach', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.forEach callback must be a function'"); 88 shouldThrow("testPrototypeFunction('forEach', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.forEach callback must be a function'"); 89 shouldThrow("testPrototypeFunction('forEach', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.forEach callback must be a function'"); 90 90 debug(""); 91 91 finishJSTest(); -
trunk/Source/JavaScriptCore/tests/stress/typedarray-map.js
r190429 r191300 43 43 44 44 debug("5.0 Wrong Type for Callback Test"); 45 shouldThrow("testPrototypeFunction('map', '(8)', [12, 15, 10, 13, 44], false)" );46 shouldThrow("testPrototypeFunction('map', '(\"wrong\")', [12, 15, 10, 13, 44], false)" );47 shouldThrow("testPrototypeFunction('map', '(new Object())', [12, 15, 10, 13, 44], false)" );48 shouldThrow("testPrototypeFunction('map', '(null)', [12, 15, 10, 13, 44], false)" );49 shouldThrow("testPrototypeFunction('map', '()', [12, 15, 10, 13, 44], false)" );45 shouldThrow("testPrototypeFunction('map', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.map callback must be a function'"); 46 shouldThrow("testPrototypeFunction('map', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.map callback must be a function'"); 47 shouldThrow("testPrototypeFunction('map', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.map callback must be a function'"); 48 shouldThrow("testPrototypeFunction('map', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.map callback must be a function'"); 49 shouldThrow("testPrototypeFunction('map', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.map callback must be a function'"); 50 50 debug(""); 51 51 finishJSTest(); -
trunk/Source/JavaScriptCore/tests/stress/typedarray-reduce.js
r190429 r191300 50 50 51 51 debug("5.0 Wrong Type for Callback Test"); 52 shouldThrow("testPrototypeFunction('reduce', '(8)', [12, 15, 10, 13, 44], false)"); 53 shouldThrow("testPrototypeFunction('reduce', '(\"wrong\")', [12, 15, 10, 13, 44], false)"); 54 shouldThrow("testPrototypeFunction('reduce', '(new Object())', [12, 15, 10, 13, 44], false)"); 55 shouldThrow("testPrototypeFunction('reduce', '(null)', [12, 15, 10, 13, 44], false)"); 56 shouldThrow("testPrototypeFunction('reduce', '()', [12, 15, 10, 13, 44], false)"); 52 shouldThrow("testPrototypeFunction('reduce', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduce callback must be a function'"); 53 shouldThrow("testPrototypeFunction('reduce', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduce callback must be a function'"); 54 shouldThrow("testPrototypeFunction('reduce', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduce callback must be a function'"); 55 shouldThrow("testPrototypeFunction('reduce', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduce callback must be a function'"); 56 shouldThrow("testPrototypeFunction('reduce', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduce callback must be a function'"); 57 shouldThrow("testPrototypeFunction('reduce', '(new Function())', [], false)", "'TypeError: TypedArray.prototype.reduce of empty array with no initial value'"); 57 58 debug(""); 58 59 finishJSTest(); -
trunk/Source/JavaScriptCore/tests/stress/typedarray-reduceRight.js
r190429 r191300 50 50 51 51 debug("5.0 Wrong Type for Callback Test"); 52 shouldThrow("testPrototypeFunction('reduceRight', '(8)', [12, 15, 10, 13, 44], false)"); 53 shouldThrow("testPrototypeFunction('reduceRight', '(\"wrong\")', [12, 15, 10, 13, 44], false)"); 54 shouldThrow("testPrototypeFunction('reduceRight', '(new Object())', [12, 15, 10, 13, 44], false)"); 55 shouldThrow("testPrototypeFunction('reduceRight', '(null)', [12, 15, 10, 13, 44], false)"); 56 shouldThrow("testPrototypeFunction('reduceRight', '()', [12, 15, 10, 13, 44], false)"); 52 shouldThrow("testPrototypeFunction('reduceRight', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduceRight callback must be a function'"); 53 shouldThrow("testPrototypeFunction('reduceRight', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduceRight callback must be a function'"); 54 shouldThrow("testPrototypeFunction('reduceRight', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduceRight callback must be a function'"); 55 shouldThrow("testPrototypeFunction('reduceRight', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduceRight callback must be a function'"); 56 shouldThrow("testPrototypeFunction('reduceRight', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.reduceRight callback must be a function'"); 57 shouldThrow("testPrototypeFunction('reduceRight', '(new Function())', [], false)", "'TypeError: TypedArray.prototype.reduceRight of empty array with no initial value'"); 57 58 debug(""); 58 59 finishJSTest(); -
trunk/Source/JavaScriptCore/tests/stress/typedarray-some.js
r190429 r191300 48 48 49 49 debug("5.0 Wrong Type for Callback Test"); 50 shouldThrow("testPrototypeFunction('some', '(8)', [12, 15, 10, 13, 44], false)" );51 shouldThrow("testPrototypeFunction('some', '(\"wrong\")', [12, 15, 10, 13, 44], false)" );52 shouldThrow("testPrototypeFunction('some', '(new Object())', [12, 15, 10, 13, 44], false)" );53 shouldThrow("testPrototypeFunction('some', '(null)', [12, 15, 10, 13, 44], false)" );54 shouldThrow("testPrototypeFunction('some', '()', [12, 15, 10, 13, 44], false)" );50 shouldThrow("testPrototypeFunction('some', '(8)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.some callback must be a function'"); 51 shouldThrow("testPrototypeFunction('some', '(\"wrong\")', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.some callback must be a function'"); 52 shouldThrow("testPrototypeFunction('some', '(new Object())', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.some callback must be a function'"); 53 shouldThrow("testPrototypeFunction('some', '(null)', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.some callback must be a function'"); 54 shouldThrow("testPrototypeFunction('some', '()', [12, 15, 10, 13, 44], false)", "'TypeError: TypedArray.prototype.some callback must be a function'"); 55 55 debug(""); 56 56 finishJSTest();
Note:
See TracChangeset
for help on using the changeset viewer.