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

Side by Side Diff: test/codegen/lib/mirrors/model_test.dart

Issue 2265533002: Add mirrors tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « test/codegen/lib/mirrors/model.dart ('k') | test/codegen/lib/mirrors/native_class_test.dart » ('j') | 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 library test.model_test;
6
7 import 'package:expect/expect.dart';
8
9 import 'model.dart';
10
11 isNoSuchMethodError(e) => e is NoSuchMethodError;
12
13 main() {
14 var a = new A();
15 var b = new B();
16 var c = new C();
17
18 Expect.isNull(a.field);
19 Expect.equals('B:get field', b.field);
20 Expect.equals('B:get field', c.field);
21
22 a.field = 42;
23 b.field = 87;
24 c.field = 89;
25 Expect.equals(42, a.field);
26 Expect.equals('B:get field', b.field);
27 Expect.equals('B:get field', c.field);
28 Expect.equals(89, fieldC);
29
30 Expect.equals('A:instanceMethod(7)', a.instanceMethod(7));
31 Expect.equals('B:instanceMethod(9)', b.instanceMethod(9));
32 Expect.equals('C:instanceMethod(13)', c.instanceMethod(13));
33
34 Expect.equals('A:get accessor', a.accessor);
35 Expect.equals('B:get accessor', b.accessor);
36 Expect.equals('C:get accessor', c.accessor);
37
38 a.accessor = 'foo';
39 b.accessor = 'bar';
40 c.accessor = 'baz';
41
42 Expect.equals('foo', accessorA);
43 Expect.equals('bar', accessorB);
44 Expect.equals('baz', accessorC);
45
46 Expect.equals('aMethod', a.aMethod());
47 Expect.equals('aMethod', b.aMethod());
48 Expect.equals('aMethod', c.aMethod());
49
50 Expect.throws(() { a.bMethod(); }, isNoSuchMethodError);
51 Expect.equals('bMethod', b.bMethod());
52 Expect.equals('bMethod', c.bMethod());
53
54 Expect.throws(() { a.cMethod(); }, isNoSuchMethodError);
55 Expect.throws(() { b.cMethod(); }, isNoSuchMethodError);
56 Expect.equals('cMethod', c.cMethod());
57 }
OLDNEW
« no previous file with comments | « test/codegen/lib/mirrors/model.dart ('k') | test/codegen/lib/mirrors/native_class_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698