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

Unified Diff: test/codegen/lib/mirrors/static_members_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 side-by-side diff with in-line comments
Download patch
Index: test/codegen/lib/mirrors/static_members_test.dart
diff --git a/test/codegen/lib/mirrors/static_members_test.dart b/test/codegen/lib/mirrors/static_members_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a4551cc96cf7d1a162e08c4681515d0b5326e0b0
--- /dev/null
+++ b/test/codegen/lib/mirrors/static_members_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.static_members;
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+import 'stringify.dart';
+import 'declarations_model.dart' as declarations_model;
+
+selectKeys(map, predicate) {
+ return map.keys.where((key) => predicate(map[key]));
+}
+
+main() {
+ ClassMirror cm = reflectClass(declarations_model.Class);
+ LibraryMirror lm = cm.owner;
+
+ Expect.setEquals(
+ [#staticVariable,
+ const Symbol('staticVariable='),
+ #staticGetter,
+ const Symbol('staticSetter='),
+ #staticMethod,
+ MirrorSystem.getSymbol('_staticVariable', lm),
+ MirrorSystem.getSymbol('_staticVariable=', lm),
+ MirrorSystem.getSymbol('_staticGetter', lm),
+ MirrorSystem.getSymbol('_staticSetter=', lm),
+ MirrorSystem.getSymbol('_staticMethod', lm),
+ ],
+ selectKeys(cm.staticMembers, (dm) => true));
+
+ Expect.setEquals(
+ [#staticVariable,
+ const Symbol('staticVariable='),
+ MirrorSystem.getSymbol('_staticVariable', lm),
+ MirrorSystem.getSymbol('_staticVariable=', lm)],
+ selectKeys(cm.staticMembers, (dm) => dm.isSynthetic));
+}
« no previous file with comments | « test/codegen/lib/mirrors/static_members_easier_test.dart ('k') | test/codegen/lib/mirrors/static_metatarget_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698