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

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

Issue 10800065: Added ClosureMirror to dart:mirrors. Added Dart_ClosureFunction to the (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/mirrors_test.dart
===================================================================
--- tests/lib/mirrors/mirrors_test.dart (revision 9835)
+++ tests/lib/mirrors/mirrors_test.dart (working copy)
@@ -45,9 +45,26 @@
}));
}
+testClosureMirrors(mirrors) {
+ var closure = (x, y, z) { return x + y + z; };
+
+ var mirror = mirrors.mirrorOf(closure);
+ expect(mirror is ClosureMirror, equals(true));
+
+ var funcMirror = mirror.function();
+ expect(funcMirror is MethodMirror, equals(true));
+ expect(funcMirror.parameters().length, equals(3));
+
+ var future = mirror.apply([2, 4, 8]);
+ future.then(expectAsync1((resultMirror) {
+ expect(resultMirror.reflectee, equals(14));
+ }));
+}
+
main() {
var mirrors = currentMirrorSystem();
test("Test field access", () { testFieldAccess(mirrors); });
+ test("Test closure mirrors", () { testClosureMirrors(mirrors); });
}
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698