Chromium Code Reviews| Index: test/mjsunit/harmony/toMethod.js |
| diff --git a/test/mjsunit/harmony/toMethod.js b/test/mjsunit/harmony/toMethod.js |
| index ad51b2ff3809001d159443c731408c86f3f36902..8fa859068bc38269512d7dc30acb3982694a8cf6 100644 |
| --- a/test/mjsunit/harmony/toMethod.js |
| +++ b/test/mjsunit/harmony/toMethod.js |
| @@ -46,6 +46,33 @@ |
| assertThrows(function() { sFun.call({}, {}); }, TypeError); |
| function f(){}; |
| assertThrows(function() { f.toMethod(1); }, TypeError); |
| + try { |
| + Function.prototype.toMethod.call(null, null); |
| + // This must never be reached: |
| + assertEquals(true, false); |
|
arv (Not doing code reviews)
2014/12/09 21:59:21
assertUnreachable()
|
| + } catch (exception) { |
| + assertTrue(exception instanceof TypeError); |
| + assertEquals('Function.prototype.toMethod: home object null ' + |
| + 'is not an object', exception.message); |
|
arv (Not doing code reviews)
2014/12/09 21:59:20
+2 indent
|
| + } |
| + try { |
| + Function.prototype.toMethod.call(42, null); |
| + // This must never be reached: |
| + assertEquals(true, false); |
| + } 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, {}); |
| + // This must never be reached: |
| + assertEquals(true, false); |
| + } catch (exception) { |
| + assertTrue(exception instanceof TypeError); |
| + assertEquals('Function.prototype.toMethod was called on 42, which is a ' + |
| + 'number and not a function', exception.message); |
| + } |
|
mathiasb
2014/12/09 21:59:11
I’d love to use `assertThrows` here, but its optio
|
| }()); |