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

Side by Side Diff: tests/compiler/dart2js_native/native_mixin_field_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:_js_helper"; 5 import "dart:_js_helper";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 // Test that native classes can use ordinary Dart classes with fields 8 // Test that native classes can use ordinary Dart classes with fields
9 // as mixins. 9 // as mixins.
10 10
11 @Native("A") 11 @Native("A")
12 class A { 12 class A {
13 var foo; 13 var foo;
14 } 14 }
15 15
16 @Native("B") 16 @Native("B")
17 class B extends A with M1, M2 { 17 class B extends A with M1, M2 {
18 var bar; 18 var bar;
19 } 19 }
20 20
21 class M1 { 21 class M1 {
22 var baz; // This field is not a native field, even when mixed in. 22 var baz; // This field is not a native field, even when mixed in.
23 } 23 }
24 24
25 class M2 { 25 class M2 {
26 var bar; 26 var bar;
27 var buz; 27 var buz;
28 } 28 }
29 29
30 A makeA() native; 30 A makeA() native ;
31 B makeB() native; 31 B makeB() native ;
32 32
33 void setup() native """ 33 void setup() native """
34 function A() {this.foo='A-foo';} 34 function A() {this.foo='A-foo';}
35 function B() {A.call(this);this.bar='B-bar';this.baz='M1-baz';} 35 function B() {A.call(this);this.bar='B-bar';this.baz='M1-baz';}
36 makeA = function(){return new A;}; 36 makeA = function(){return new A;};
37 makeB = function(){return new B;}; 37 makeB = function(){return new B;};
38 """; 38 """;
39 39
40 main() { 40 main() {
41 setup(); 41 setup();
42 A a = makeA(); 42 A a = makeA();
43 Expect.equals("A-foo", a.foo); 43 Expect.equals("A-foo", a.foo);
44 Expect.throws(() => a.bar, (e) => e is NoSuchMethodError); 44 Expect.throws(() => a.bar, (e) => e is NoSuchMethodError);
45 Expect.throws(() => a.baz, (e) => e is NoSuchMethodError); 45 Expect.throws(() => a.baz, (e) => e is NoSuchMethodError);
46 Expect.throws(() => a.buz, (e) => e is NoSuchMethodError); 46 Expect.throws(() => a.buz, (e) => e is NoSuchMethodError);
47 47
48 B b = makeB(); 48 B b = makeB();
49 Expect.equals("A-foo", b.foo); 49 Expect.equals("A-foo", b.foo);
50 Expect.equals("B-bar", b.bar); 50 Expect.equals("B-bar", b.bar);
51 // Expect.equals("M1-baz", b.baz); // not true, see M1. 51 // Expect.equals("M1-baz", b.baz); // not true, see M1.
52 Expect.isNull(b.baz); // native b.baz is not the same as dart b.baz. 52 Expect.isNull(b.baz); // native b.baz is not the same as dart b.baz.
53 Expect.isNull(b.buz); 53 Expect.isNull(b.buz);
54 54
55 M1 m1 = new M1(); 55 M1 m1 = new M1();
56 Expect.throws(() => m1.foo, (e) => e is NoSuchMethodError); 56 Expect.throws(() => m1.foo, (e) => e is NoSuchMethodError);
57 Expect.throws(() => m1.bar, (e) => e is NoSuchMethodError); 57 Expect.throws(() => m1.bar, (e) => e is NoSuchMethodError);
58 Expect.isNull(m1.baz); 58 Expect.isNull(m1.baz);
59 Expect.throws(() => m1.buz, (e) => e is NoSuchMethodError); 59 Expect.throws(() => m1.buz, (e) => e is NoSuchMethodError);
60 60
61 M2 m2 = new M2(); 61 M2 m2 = new M2();
62 Expect.throws(() => m2.foo, (e) => e is NoSuchMethodError); 62 Expect.throws(() => m2.foo, (e) => e is NoSuchMethodError);
63 Expect.isNull(m2.bar); 63 Expect.isNull(m2.bar);
64 Expect.throws(() => m2.baz, (e) => e is NoSuchMethodError); 64 Expect.throws(() => m2.baz, (e) => e is NoSuchMethodError);
65 Expect.isNull(m2.buz); 65 Expect.isNull(m2.buz);
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698