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

Unified Diff: tests/language/const_map_test.dart

Issue 177053004: Use normal equality for const maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean test Created 6 years, 10 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/const_map_test.dart
diff --git a/tests/compiler/dart2js_extra/16407_test.dart b/tests/language/const_map_test.dart
similarity index 53%
copy from tests/compiler/dart2js_extra/16407_test.dart
copy to tests/language/const_map_test.dart
index aff1ba337ddab1eb5d219ac635653b48d4f8d1bc..de30f8a1fb9b49c4c6d76e6bc6eacce3a5166d10 100644
--- a/tests/compiler/dart2js_extra/16407_test.dart
+++ b/tests/language/const_map_test.dart
@@ -4,13 +4,13 @@
import "package:expect/expect.dart";
-// Regression test for Issue 16407.
-
-void main() {
- foo(null, true);
- foo('x', false);
+confuse(x) {
Lasse Reichstein Nielsen 2014/03/03 10:31:24 Document "confuse": Used to prevent static optimiz
floitsch 2014/03/03 10:42:38 Done.
+ if (new DateTime.now() == 42) return confuse(2);
+ return x;
}
-var foo = (x, result) {
- Expect.equals(result, x is Null, '$x is Null');
-};
+main() {
+ // Make sure that const maps use the == operator and not identical.
Lasse Reichstein Nielsen 2014/03/03 10:31:24 Way that the spec doesn't require this explicitly,
floitsch 2014/03/03 10:42:38 Added string test and added more comment.
+ var m = const { 1: 42 };
+ Expect.equals(42, m[confuse(1.0)]);
+}
« sdk/lib/_internal/lib/constant_map.dart ('K') | « sdk/lib/_internal/lib/constant_map.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698