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

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

Issue 10704259: Added getField/setField to ObjectMirror. For InstanceMirrors, this get/sets (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
« tests/lib/lib.status ('K') | « 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #library("MirrorsTest.dart");
6 #import("dart:mirrors");
7
8
turnidge 2012/07/17 23:59:33 Add a TODO to move the existing mirrors tests out
9 var topLevelField;
10 topLevelFunction() {}
11
12 class Class {
13 var field;
14 static var staticField;
15 }
16
17 main() {
18
turnidge 2012/07/17 23:59:33 No blank line here.
19 var instance = new Class();
20
turnidge 2012/07/17 23:59:33 We will eventually have more tests in this file.
21 var mirrors = currentMirrorSystem();
22 var libMirror = mirrors.rootLibrary;
23 var classMirror = libMirror.classes()["Class"];
24 var instMirror = mirrors.mirrorOf(instance);
25
26 libMirror.setField('topLevelField', 42);
27 Expect.equals(42, libMirror.getField('topLevelField').value.reflectee );
turnidge 2012/07/17 23:59:33 It's a little weird for the test to rely on the fu
rmacnak 2012/07/18 00:48:55 But then there should also be some check that the
turnidge 2012/07/18 05:07:35 Yes. I think they have some way of doing this in
rmacnak 2012/07/18 18:04:18 There is no such method on Expect, and I don't see
28 Expect.equals(42, topLevelField );
29
30 classMirror.setField('staticField', 43);
31 Expect.equals(43, classMirror.getField('staticField').value.reflectee );
32 Expect.equals(43, Class.staticField );
33
34 instMirror.setField('field', 44);
35 Expect.equals(44, instMirror.getField('field').value.reflectee );
36 Expect.equals(44, instance.field );
37 }
38
OLDNEW
« tests/lib/lib.status ('K') | « tests/lib/lib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698