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

Unified Diff: tests/language/first_class_types_test.dart

Issue 10942028: Support class and typedef literals as expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix two long lines. Created 8 years, 2 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698