Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Unified Diff: test/webkit/array-proto-func-length-getter-except.js

Issue 18068003: Migrated several tests from blink to V8 repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/webkit/array-proto-func-length-getter-except.js
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/array-proto-func-length-getter-except.js
similarity index 53%
copy from test/webkit/concat-while-having-a-bad-time.js
copy to test/webkit/array-proto-func-length-getter-except.js
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..658479596935abc34c2aeb6ab42fe6f3643c0b52 100644
--- a/test/webkit/concat-while-having-a-bad-time.js
+++ b/test/webkit/array-proto-func-length-getter-except.js
@@ -22,10 +22,43 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating."
+"This test checks that functions on the array prototype correctly handle exceptions from length getters when called on non-array objects."
);
-Object.defineProperty(Array.prototype, 0, { writable: false });
-shouldBe("[42].concat()", "[42]");
+var testObj = {
+ 0: "a",
+ 1: "b",
+ 2: "c"
+};
+var lengthGetter = {
+ get: (function() { throw true; })
+}
+Object.defineProperty(testObj, "length", lengthGetter);
+function test(f) {
+ try {
+ f.call(testObj, undefined);
+ return false;
+ } catch (e) {
+ return e === true;
+ }
+}
+shouldBeTrue("test(Array.prototype.join)");
+shouldBeTrue("test(Array.prototype.pop)");
+shouldBeTrue("test(Array.prototype.push)");
+shouldBeTrue("test(Array.prototype.reverse)");
+shouldBeTrue("test(Array.prototype.shift)");
+shouldBeTrue("test(Array.prototype.slice)");
+shouldBeTrue("test(Array.prototype.sort)");
+shouldBeTrue("test(Array.prototype.splice)");
+shouldBeTrue("test(Array.prototype.unshift)");
+shouldBeTrue("test(Array.prototype.indexOf)");
+shouldBeTrue("test(Array.prototype.lastIndexOf)");
+shouldBeTrue("test(Array.prototype.every)");
+shouldBeTrue("test(Array.prototype.some)");
+shouldBeTrue("test(Array.prototype.forEach)");
+shouldBeTrue("test(Array.prototype.map)");
+shouldBeTrue("test(Array.prototype.filter)");
+shouldBeTrue("test(Array.prototype.reduce)");
+shouldBeTrue("test(Array.prototype.reduceRight)");
« no previous file with comments | « test/webkit/array-lastIndexOf-expected.txt ('k') | test/webkit/array-proto-func-length-getter-except-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698