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

Unified Diff: test/mjsunit/regress/regress-485.js

Issue 6087011: Draft of ES5 fix to Function.prototype.call and apply (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 12 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
« no previous file with comments | « test/mjsunit/compiler/regress-arguments.js ('k') | test/mjsunit/value-wrapper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-485.js
diff --git a/test/mjsunit/regress/regress-485.js b/test/mjsunit/regress/regress-485.js
index 62c6fb95bc390c9e460086430f4598a3bc49c3fa..20510a6960860c87cebb4431354a7ca650838269 100755
--- a/test/mjsunit/regress/regress-485.js
+++ b/test/mjsunit/regress/regress-485.js
@@ -38,18 +38,18 @@ var builtin = Object.prototype.valueOf; // Builtin function that returns this.
assertEquals(global, builtin(), "Direct call to builtin");
-assertEquals(global, builtin.call(), "call() to builtin");
-assertEquals(global, builtin.call(null), "call(null) to builtin");
-assertEquals(global, builtin.call(undefined), "call(undefined) to builtin");
+assertThrows(function() { builtin.call(); }, TypeError); // call() to builtin
+assertThrows(function() { builtin.call(null); }, TypeError); // call(null) to builtin
+assertThrows(function() { builtin.call(undefined); }, TypeError); // call(undefined) to builtin
-assertEquals(global, builtin.apply(), "apply() to builtin");
-assertEquals(global, builtin.apply(null), "apply(null) to builtin");
-assertEquals(global, builtin.apply(undefined), "apply(undefined) to builtin");
+assertThrows(function() { builtin.apply(); }, TypeError); // apply() to builtin
+assertThrows(function() { builtin.apply(null); }, TypeError); // apply(null) to builtin
+assertThrows(function() { builtin.apply(undefined); }, TypeError); // apply(undefined) to builtin
-assertEquals(global, builtin.call.call(builtin), "call.call() to builtin");
-assertEquals(global, builtin.call.apply(builtin), "call.apply() to builtin");
-assertEquals(global, builtin.apply.call(builtin), "apply.call() to builtin");
-assertEquals(global, builtin.apply.apply(builtin), "apply.apply() to builtin");
+assertThrows(function() { builtin.call.call(builtin); }, TypeError); // call.call() to builtin
+assertThrows(function() { builtin.call.apply(builtin); }, TypeError); // call.apply() to builtin
+assertThrows(function() { builtin.apply.call(builtin); }, TypeError); // apply.call() to builtin
+assertThrows(function() { builtin.apply.apply(builtin); }, TypeError); // apply.apply() to builtin
// Builtin that depends on value of this to compute result.
@@ -58,7 +58,6 @@ var builtin2 = Object.prototype.toString;
// Global object has class "Object" according to Object.prototype.toString.
// Builtins object displays as "[object builtins]".
assertTrue("[object builtins]" != builtin2(), "Direct call to toString");
-assertTrue("[object builtins]" != builtin2.call(), "call() to toString");
-assertTrue("[object builtins]" != builtin2.apply(), "call() to toString");
-assertTrue("[object builtins]" != builtin2.call.call(builtin2),
- "call.call() to toString");
+assertThrows(function() { builtin2.call(); }, TypeError); // call() to toString
+assertThrows(function() { builtin2.apply(); }, TypeError); // apply() to toString
+assertThrows(function() { builtin2.call.call(builtin2); }, TypeError); // call.call() to toString
« no previous file with comments | « test/mjsunit/compiler/regress-arguments.js ('k') | test/mjsunit/value-wrapper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698