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

Unified Diff: tests/lib/mirrors/method_mirror_test.dart

Issue 19299003: Moved some MethodMirror properties from embedded API to native calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« runtime/lib/mirrors.cc ('K') | « runtime/vm/bootstrap_natives.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/method_mirror_test.dart
diff --git a/tests/lib/mirrors/method_mirror_test.dart b/tests/lib/mirrors/method_mirror_test.dart
index 16851c9c209a1634de02ddac7d1103fd82c14204..306d8570f6089833d0d94530d3d90b90c86ea215 100644
--- a/tests/lib/mirrors/method_mirror_test.dart
+++ b/tests/lib/mirrors/method_mirror_test.dart
@@ -12,10 +12,78 @@ String _symbolToString(Symbol sym) {
doNothing42() {}
+int _x = 5;
+int get topGetter => _x;
+void set topSetter(x) { _x = x }
+
+class AbstractC {
+
+ AbstractC();
+
+ void bar();
+ get priv;
+ set priv(value);
+}
+
+class C extends AbstractC {
+
+ static foo() {}
+
+ C();
+ C.other();
+ C.other2() : this.other();
+
+ var _priv;
+ get priv => _priv;
+ set priv(value) => _priv = value;
+}
+
+checkKinds(method, kinds) {
+ expect(method.isStatic, kinds[0]);
+ expect(method.isAbstract, kinds[1]);
+ expect(method.isGetter, kinds[2]);
+ expect(method.isSetter, kinds[3]);
+ expect(method.isConstructor, kinds[4]);
+}
+
main() {
// Regression test for http://www.dartbug.com/6335
test("NamedMethodName", () {
var closureMirror = reflect(doNothing42);
expect(_symbolToString(closureMirror.function.simpleName), "doNothing42");
});
+ test("FunctionKinds", () {
ahe 2013/07/16 20:36:53 As far as I can tell, the added tests reuse virtua
Michael Lippautz (Google) 2013/07/16 21:14:00 Done.
+ // Top level functions should be static.
+ var closureMirror = reflect(doNothing42);
+ checkKinds(closureMirror.function,
+ [true, false, false, false, false]);
+ var libraryMirror = reflectClass(C).owner;
+ checkKinds(libraryMirror.getters[const Symbol("topGetter")],
+ [true, false, true, false, false]);
+ checkKinds(libraryMirror.setters[const Symbol("topSetter=")],
+ [true, false, false, true, false]);
+ var classMirror;
+ classMirror = reflectClass(C);
+ checkKinds(classMirror.members[const Symbol("foo")],
+ [true, false, false, false, false]);
+ checkKinds(classMirror.members[const Symbol("priv")],
+ [false, false, true, false, false]);
+ checkKinds(classMirror.members[const Symbol("priv=")],
+ [false, false, false, true, false]);
+ checkKinds(classMirror.constructors[const Symbol("C")],
+ [false, false, false, false, true]);
+ checkKinds(classMirror.constructors[const Symbol("C.other")],
+ [false, false, false, false, true]);
+ checkKinds(classMirror.constructors[const Symbol("C.other2")],
+ [false, false, false, false, true]);
+ classMirror = reflectClass(AbstractC);
+ checkKinds(classMirror.constructors[const Symbol("AbstractC")],
+ [false, false, false, false, true]);
+ checkKinds(classMirror.members[const Symbol("bar")],
+ [false, true, false, false, false]);
+ checkKinds(classMirror.members[const Symbol("priv")],
+ [false, true, true, false, false]);
+ checkKinds(classMirror.members[const Symbol("priv=")],
+ [false, true, false, true, false]);
+ });
}
« runtime/lib/mirrors.cc ('K') | « runtime/vm/bootstrap_natives.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698