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

Unified Diff: test/codegen/lib/mirrors/typedef_in_signature_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/typedef_in_signature_test.dart
diff --git a/test/codegen/lib/mirrors/typedef_in_signature_test.dart b/test/codegen/lib/mirrors/typedef_in_signature_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..baa06257a8397709c1a0ff1cf0fb4840ffc54c94
--- /dev/null
+++ b/test/codegen/lib/mirrors/typedef_in_signature_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2014, 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.typedef_in_signature_test;
+
+@MirrorsUsed(targets: 'test.typedef_in_signature_test')
+import 'dart:mirrors';
+
+import "package:expect/expect.dart";
+
+typedef int foo();
+typedef String foo2();
+typedef foo foo3(foo2 x);
+
+foo2 bar(foo x) {
+ return null;
+}
+
+foo3 gee(int x, foo3 tt) => null;
+
+main() {
+ var lm = currentMirrorSystem().findLibrary(#test.typedef_in_signature_test);
+ var ftm = lm.declarations[#bar];
+ Expect.equals(reflectType(foo2), ftm.returnType);
+ Expect.equals(reflectType(foo), ftm.parameters[0].type);
+ ftm = lm.declarations[#gee];
+ Expect.equals(reflectType(int), ftm.parameters[0].type);
+ Expect.equals(reflectType(foo3), ftm.returnType);
+ ftm = ftm.returnType.referent;
+ Expect.equals(reflectType(foo), ftm.returnType);
+ Expect.equals(reflectType(foo2), ftm.parameters[0].type);
+}
« no previous file with comments | « test/codegen/lib/mirrors/typedef_deferred_library_test.dart ('k') | test/codegen/lib/mirrors/typedef_library.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698