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

Unified Diff: tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart

Issue 11308091: Add TypeImpl.hashCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved the test to dart2js_extra. Created 8 years, 1 month 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_helper.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart
diff --git a/tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart b/tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2c5d989184caeadb0620322257221e2f90be2b40
--- /dev/null
+++ b/tests/compiler/dart2js_extra/first_class_types_hashcode_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2012, 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.
+
+// Check that Type instances work with maps.
ngeoffray 2012/11/19 15:40:32 Please add the comment that it assumes canonicaliz
+
+class A {}
+
+class B<T> {}
+
+main() {
+ Map<Type, String> map = new Map<Type, String>();
+ A a = new A().runtimeType;
+ B b1 = new B<int>().runtimeType;
+ B b2 = new B<String>().runtimeType;
+ map[a] = 'A';
+ map[b1] = 'B<int>';
+ map[b2] = 'B<String>';
+ Expect.equals('A', map[new A().runtimeType]);
+ Expect.equals('B<int>', map[new B<int>().runtimeType]);
+ Expect.equals('B<String>', map[new B<String>().runtimeType]);
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698