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

Unified Diff: test/codegen/lib/mirrors/type_argument_is_type_variable_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/type_argument_is_type_variable_test.dart
diff --git a/test/codegen/lib/mirrors/type_argument_is_type_variable_test.dart b/test/codegen/lib/mirrors/type_argument_is_type_variable_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..abada7f4976b3227e1098104fee97d23fd04f702
--- /dev/null
+++ b/test/codegen/lib/mirrors/type_argument_is_type_variable_test.dart
@@ -0,0 +1,52 @@
+// 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.type_argument_is_type_variable;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+import 'generics_helper.dart';
+
+class SuperSuper<SS> {}
+class Super<S> extends SuperSuper<S> {}
+class Generic<G> extends Super<G> {}
+
+main() {
+ // Declarations.
+ ClassMirror generic = reflectClass(Generic);
+ ClassMirror superOfGeneric = generic.superclass;
+ ClassMirror superOfSuperOfGeneric = superOfGeneric.superclass;
+
+ TypeVariableMirror gFromGeneric = generic.typeVariables.single;
+ TypeVariableMirror sFromSuper = superOfGeneric.typeVariables.single;
+ TypeVariableMirror ssFromSuperSuper = superOfSuperOfGeneric.typeVariables.single;
+
+ Expect.equals(#G, gFromGeneric.simpleName);
+ Expect.equals(#S, sFromSuper.simpleName);
+ Expect.equals(#SS, ssFromSuperSuper.simpleName);
+
+ typeParameters(generic, [#G]);
+ typeParameters(superOfGeneric, [#S]);
+ typeParameters(superOfSuperOfGeneric, [#SS]);
+
+ typeArguments(generic, []);
+ typeArguments(superOfGeneric, [gFromGeneric]);
+ typeArguments(superOfSuperOfGeneric, [gFromGeneric]);
+
+
+ // Instantiations.
+ ClassMirror genericWithInt = reflect(new Generic<int>()).type;
+ ClassMirror superOfGenericWithInt = genericWithInt.superclass;
+ ClassMirror superOfSuperOfGenericWithInt = superOfGenericWithInt.superclass;
+
+ typeParameters(genericWithInt, [#G]);
+ typeParameters(superOfGenericWithInt, [#S]);
+ typeParameters(superOfSuperOfGenericWithInt, [#SS]);
+
+ typeArguments(genericWithInt, [reflectClass(int)]);
+ typeArguments(superOfGenericWithInt, [reflectClass(int)]);
+ typeArguments(superOfSuperOfGenericWithInt, [reflectClass(int)]);
+}
« no previous file with comments | « test/codegen/lib/mirrors/top_level_accessors_test.dart ('k') | test/codegen/lib/mirrors/type_mirror_for_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698