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

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

Issue 12079022: Add test for native mixin fields and fix the implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix comment. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Test that native classes can use ordinary Dart classes with fields
6 // as mixins.
7
8 class A native "*A" {
9 var foo;
10 }
11
12 class B extends A with M1, M2 native "*B" {
13 var bar;
14 }
15
16 class M1 {
17 var baz;
18 }
19
20 class M2 {
21 var bar;
22 var buz;
23 }
24
25 A makeA() native;
26 B makeB() native;
27
28 void setup() native """
29 function A() {this.foo='A-foo';}
30 function B() {A.call(this);this.bar='B-bar';this.baz='M1-baz';}
31 makeA = function(){return new A;};
32 makeB = function(){return new B;};
33 """;
34
35 main() {
36 setup();
37 A a = makeA();
38 Expect.equals("A-foo", a.foo);
39 Expect.throws(() => a.bar, (e) => e is NoSuchMethodError);
40 Expect.throws(() => a.baz, (e) => e is NoSuchMethodError);
41 Expect.throws(() => a.buz, (e) => e is NoSuchMethodError);
42
43 B b = makeB();
44 Expect.equals("A-foo", b.foo);
45 Expect.equals("B-bar", b.bar);
46 Expect.equals("M1-baz", b.baz);
47 Expect.isNull(b.buz);
48
49 M1 m1 = new M1();
50 Expect.throws(() => m1.foo, (e) => e is NoSuchMethodError);
51 Expect.throws(() => m1.bar, (e) => e is NoSuchMethodError);
52 Expect.isNull(m1.baz);
53 Expect.throws(() => m1.buz, (e) => e is NoSuchMethodError);
54
55 M2 m2 = new M2();
56 Expect.throws(() => m2.foo, (e) => e is NoSuchMethodError);
57 Expect.isNull(m2.bar);
58 Expect.throws(() => m2.baz, (e) => e is NoSuchMethodError);
59 Expect.isNull(m2.buz);
60 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698