Index: test/browser/runtime_tests.js |
diff --git a/test/browser/runtime_tests.js b/test/browser/runtime_tests.js |
index 030be22ac847fd6c3fb4f1d582bd22cd29b16f13..7e3538e9c72ebe6408439209bbcfa23de7161784 100644 |
--- a/test/browser/runtime_tests.js |
+++ b/test/browser/runtime_tests.js |
@@ -24,6 +24,20 @@ suite('generic', () => { |
assert.throws(() => { generic(function(){}); }); |
}); |
+ test('dcall noSuchMethod has correct error target', () => { |
+ assert.throws(() => dart.dcall(42), |
+ new RegExp('NoSuchMethodError.*\nReceiver: 42', 'm'), |
+ 'Calls with non-function receiver should throw a NoSuchMethodError' + |
+ ' with correct target'); |
+ |
+ // TODO(jmesserly): we should show the name "print" in there somewhere. |
+ assert.throws(() => dart.dcall(core.print, 1, 2, 3), |
+ new RegExp('NoSuchMethodError.*\n' + |
+ "Receiver: Instance of '\\(Object\\) -> void'", 'm'), |
+ 'Calls with incorrect argument types should throw a NoSuchMethodError' + |
+ ' with correct target'); |
+ }); |
+ |
test('can throw number', () => { |
try { |
dart.throw(42); |