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

Unified Diff: tests/html/js_typed_interop_type2_test.dart

Issue 2307883002: Fix type masks for js-interop types. (Closed)
Patch Set: Update status Created 4 years, 3 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 | « tests/html/js_typed_interop_type1_test.dart ('k') | tests/html/js_typed_interop_type3_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/js_typed_interop_type2_test.dart
diff --git a/tests/html/js_typed_interop_type2_test.dart b/tests/html/js_typed_interop_type2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..09350f1675c6d8079bb9e27c6c8ae45bcabe7321
--- /dev/null
+++ b/tests/html/js_typed_interop_type2_test.dart
@@ -0,0 +1,58 @@
+import 'dart:html';
+import 'package:js/js.dart';
+import 'package:expect/expect.dart';
+
+@JS()
+@anonymous
+class C {
+ final foo;
+
+ external factory C({foo});
+}
+
+@JS()
+@anonymous
+class D {
+ final foo;
+
+ external factory D({foo});
+}
+
+class F {
+ final foo;
+
+ F(this.foo);
+}
+
+@NoInline()
+testA(A o) {
+ return o.foo;
+}
+
+@NoInline()
+testC(C o) {
+ return o.foo;
+}
+
+@NoInline()
+testF(F o) {
+ return o.foo;
+}
+
+void expectValueOrTypeError(f(), value) {
+ try {
+ String i = 0; // Test for checked mode.
+ Expect.equals(f(), value);
+ } on TypeError catch (error) {
+ Expect.throws(f, (ex) => ex is TypeError);
+ }
+}
+
+main() {
+ var d = new D(foo: 4);
+ var f = new F(6);
+ Expect.equals(testC(d), 4);
+ Expect.equals(testF(f), 6); /// 01: ok
+}
+
+
« no previous file with comments | « tests/html/js_typed_interop_type1_test.dart ('k') | tests/html/js_typed_interop_type3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698