Index: tests/language/first_class_types_test.dart |
diff --git a/tests/language/first_class_types_test.dart b/tests/language/first_class_types_test.dart |
index 82c128ff13101cd305962c8c58538b8192a55b8e..35d43e7e49d06d6d2620f9c22fb1fd0278ab1560 100644 |
--- a/tests/language/first_class_types_test.dart |
+++ b/tests/language/first_class_types_test.dart |
@@ -4,10 +4,10 @@ |
class C<T> {} |
+class D {} |
+ |
sameType(a, b) { |
- print("a: ${a.runtimeType}"); |
- print("b: ${b.runtimeType}"); |
- Expect.isTrue(a.runtimeType === b.runtimeType); |
+ Expect.identical(a.runtimeType, b.runtimeType); |
} |
differentType(a, b) { |
@@ -17,6 +17,7 @@ differentType(a, b) { |
} |
main() { |
+ // Test types obtained by calling runtimeType(). |
var v1 = new C<int>(); |
var v2 = new C<int>(); |
sameType(v1, v2); |
@@ -35,4 +36,15 @@ main() { |
var m = {'a': 1, 'b': 2}; |
sameType([], l); |
sameType({}, m); |
+ |
+ // Test type literals. |
ngeoffray
2012/10/10 07:32:24
Maybe create a new test for this file, so that the
|
+ Expect.identical(int, int); |
+ Expect.isFalse(int === num); |
+ // Test that types from runtimeTypes() and literals agree. |
+ Expect.identical(int, 1.runtimeType); |
+ Expect.identical(C, new C().runtimeType); |
+ Expect.identical(D, new D().runtimeType); |
+ |
+ // runtimeType on type is idempotent. |
+ Expect.identical((D).runtimeType, (D).runtimeType.runtimeType); |
} |