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

Side by Side Diff: tests/lib/mirrors/mirrors_test.dart

Issue 10916252: Implement more of the mirrors library, primarily stuff to do with types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« runtime/lib/mirrors_impl.dart ('K') | « runtime/vm/parser.cc ('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
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // TODO(rmacnak): Move the existing mirror tests here (a place for 5 // TODO(rmacnak): Move the existing mirror tests here (a place for
6 // cross-implementation tests). 6 // cross-implementation tests).
7 7
8 #library("MirrorsTest.dart"); 8 #library("MirrorsTest.dart");
9 #import("dart:mirrors"); 9 #import("dart:mirrors");
10 #import("../../../pkg/unittest/unittest.dart"); 10 #import("../../../pkg/unittest/unittest.dart");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 expect(instance.field, equals(44)); 46 expect(instance.field, equals(44));
47 })); 47 }));
48 } 48 }
49 49
50 testClosureMirrors(mirrors) { 50 testClosureMirrors(mirrors) {
51 var closure = (x, y, z) { return x + y + z; }; 51 var closure = (x, y, z) { return x + y + z; };
52 52
53 var mirror = reflect(closure); 53 var mirror = reflect(closure);
54 expect(mirror is ClosureMirror, equals(true)); 54 expect(mirror is ClosureMirror, equals(true));
55 55
56 var funcMirror = mirror.function(); 56 var funcMirror = mirror.function;
57 expect(funcMirror is MethodMirror, equals(true)); 57 expect(funcMirror is MethodMirror, equals(true));
58 expect(funcMirror.parameters.length, equals(3)); 58 expect(funcMirror.parameters.length, equals(3));
59 59
60 var future = mirror.apply([2, 4, 8]); 60 var future = mirror.apply([2, 4, 8]);
61 future.then(expectAsync1((resultMirror) { 61 future.then(expectAsync1((resultMirror) {
62 expect(resultMirror.reflectee, equals(14)); 62 expect(resultMirror.reflectee, equals(14));
63 })); 63 }));
64 } 64 }
65 65
66 testInvokeConstructor(mirrors) { 66 testInvokeConstructor(mirrors) {
(...skipping 16 matching lines...) Expand all
83 } 83 }
84 84
85 main() { 85 main() {
86 var mirrors = currentMirrorSystem(); 86 var mirrors = currentMirrorSystem();
87 87
88 test("Test field access", () { testFieldAccess(mirrors); }); 88 test("Test field access", () { testFieldAccess(mirrors); });
89 test("Test closure mirrors", () { testClosureMirrors(mirrors); }); 89 test("Test closure mirrors", () { testClosureMirrors(mirrors); });
90 test("Test invoke constructor", () { testInvokeConstructor(mirrors); }); 90 test("Test invoke constructor", () { testInvokeConstructor(mirrors); });
91 } 91 }
92 92
OLDNEW
« runtime/lib/mirrors_impl.dart ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698