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

Unified Diff: tests/compiler/dart2js_native/type_error_decode_test.dart

Issue 2379173002: Add native_testing library to mock @Native classes (Closed)
Patch Set: xxx Created 4 years, 1 month 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: tests/compiler/dart2js_native/type_error_decode_test.dart
diff --git a/tests/compiler/dart2js_native/type_error_decode_test.dart b/tests/compiler/dart2js_native/type_error_decode_test.dart
index 3c9a8f0ace7c5a0d482559c2113ec25c52208170..1c37f03964a09acf09893036e71850a8f8c6b293 100644
--- a/tests/compiler/dart2js_native/type_error_decode_test.dart
+++ b/tests/compiler/dart2js_native/type_error_decode_test.dart
@@ -4,9 +4,8 @@
library test.type_error_decode_test;
-import 'package:expect/expect.dart';
-
-import 'dart:_js_helper';
+import 'native_testing.dart';
+import 'dart:_js_helper' show NullError, JsNoSuchMethodError;
class Foo {
var field;
@@ -41,12 +40,19 @@ main() {
var s = "Cannot call method 'foo' of null";
var nul = null;
var f = new Foo();
- // This should foil code analysis so the variables aren't inlined below.
- [].forEach((y) => f.field = nul = s = x = z = v = y);
+
expectThrows(() => x.fisk(), isNullError);
expectThrows(() => v.fisk(), isNullError);
expectThrows(() => z.fisk(), isJsNoSuchMethodError);
expectThrows(() => s.fisk(), isJsNoSuchMethodError);
expectThrows(() => null(), isNullError);
expectThrows(() => f.field(), isNullError);
+
+ expectThrows(() => confuse(x).fisk(), isNullError);
+ expectThrows(() => confuse(v).fisk(), isNullError);
+ expectThrows(() => confuse(z).fisk(), isJsNoSuchMethodError);
+ expectThrows(() => confuse(s).fisk(), isJsNoSuchMethodError);
+ expectThrows(() => confuse(null)(), isNullError);
+ expectThrows(() => confuse(f).field(), isNullError);
+ expectThrows(() => confuse(f.field)(), isNullError);
}
« no previous file with comments | « tests/compiler/dart2js_native/super_property_test.dart ('k') | tests/compiler/dart2js_native/undefined_bailout_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698