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

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

Issue 10805085: The mirror tests made the invalid assumption that the library with the tests (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « tests/lib/lib.status ('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("../../../lib/unittest/unittest.dart"); 10 #import("../../../lib/unittest/unittest.dart");
11 11
12 var topLevelField; 12 var topLevelField;
13 13
14 class Class { 14 class Class {
15 var field; 15 var field;
16 static var staticField; 16 static var staticField;
17 } 17 }
18 18
19 testFieldAccess(mirrors) { 19 testFieldAccess(mirrors) {
20 var instance = new Class(); 20 var instance = new Class();
21 21
22 var libMirror = mirrors.rootLibrary; 22 var libMirror = mirrors.libraries()["MirrorsTest.dart"];
23 var classMirror = libMirror.classes()["Class"]; 23 var classMirror = libMirror.classes()["Class"];
24 var instMirror = mirrors.mirrorOf(instance); 24 var instMirror = mirrors.mirrorOf(instance);
25 25
26 libMirror.setField('topLevelField', 42); 26 libMirror.setField('topLevelField', 42);
27 var future = libMirror.getField('topLevelField'); 27 var future = libMirror.getField('topLevelField');
28 future.then(expectAsync1((resultMirror) { 28 future.then(expectAsync1((resultMirror) {
29 expect(resultMirror.reflectee, equals(42)); 29 expect(resultMirror.reflectee, equals(42));
30 expect(topLevelField, equals(42)); 30 expect(topLevelField, equals(42));
31 })); 31 }));
32 32
(...skipping 11 matching lines...) Expand all
44 expect(instance.field, equals(44)); 44 expect(instance.field, equals(44));
45 })); 45 }));
46 } 46 }
47 47
48 main() { 48 main() {
49 var mirrors = currentMirrorSystem(); 49 var mirrors = currentMirrorSystem();
50 50
51 test("Test field access", () { testFieldAccess(mirrors); }); 51 test("Test field access", () { testFieldAccess(mirrors); });
52 } 52 }
53 53
OLDNEW
« no previous file with comments | « tests/lib/lib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698