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

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

Issue 273723003: Assume a method can be torn off, if it's accessible through reflection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. Created 6 years, 7 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: tests/lib/mirrors/get_field_test.dart
diff --git a/tests/lib/mirrors/unmangled_type_test.dart b/tests/lib/mirrors/get_field_test.dart
similarity index 52%
copy from tests/lib/mirrors/unmangled_type_test.dart
copy to tests/lib/mirrors/get_field_test.dart
index dbc6b62437908677c6fb6c1dab670b8d0dd7d2b6..feaf18fed20dc1a106993ab8ee53caf4a4cfc776 100644
--- a/tests/lib/mirrors/unmangled_type_test.dart
+++ b/tests/lib/mirrors/get_field_test.dart
@@ -2,14 +2,18 @@
// 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.
+@MirrorsUsed(targets: "A")
import 'dart:mirrors';
import 'package:expect/expect.dart';
-class Foo {
+class A {
+ foo(y, [x]) => y;
}
main() {
- Expect.stringEquals('Foo', '${new Foo().runtimeType}');
- Expect.stringEquals('foo', MirrorSystem.getName(new Symbol('foo')));
+ // We are using `getField` to tear off `foo`. We must make sure that all
+ // stub methods are installed.
+ var closure = reflect(new A()).getField(#foo).reflectee;
+ Expect.equals("b", closure("b"));
}

Powered by Google App Engine
This is Rietveld 408576698