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

Unified Diff: test/mjsunit/harmony/toMethod.js

Issue 785303002: Function#toMethod: check `newHome` before `this` (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated as per Erik’s feedback Created 6 years 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 | « src/harmony-classes.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/toMethod.js
diff --git a/test/mjsunit/harmony/toMethod.js b/test/mjsunit/harmony/toMethod.js
index ad51b2ff3809001d159443c731408c86f3f36902..541e4a4032e4b09418d2e3602ef79d85d79bef24 100644
--- a/test/mjsunit/harmony/toMethod.js
+++ b/test/mjsunit/harmony/toMethod.js
@@ -46,6 +46,30 @@
assertThrows(function() { sFun.call({}, {}); }, TypeError);
function f(){};
assertThrows(function() { f.toMethod(1); }, TypeError);
+ try {
+ Function.prototype.toMethod.call(null, null);
+ assertUnreachable();
+ } catch (exception) {
+ assertTrue(exception instanceof TypeError);
+ assertEquals('Function.prototype.toMethod: home object null ' +
+ 'is not an object', exception.message);
+ }
+ try {
+ Function.prototype.toMethod.call(42, null);
+ assertUnreachable();
+ } catch (exception) {
+ assertTrue(exception instanceof TypeError);
+ assertEquals('Function.prototype.toMethod: home object null ' +
+ 'is not an object', exception.message);
+ }
+ try {
+ Function.prototype.toMethod.call(42, {});
+ assertUnreachable();
+ } catch (exception) {
+ assertTrue(exception instanceof TypeError);
+ assertEquals('Function.prototype.toMethod was called on 42, which is a ' +
+ 'number and not a function', exception.message);
+ }
}());
« no previous file with comments | « src/harmony-classes.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698