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

Unified Diff: tests/language/const_string_test.dart

Issue 1558033002: Canonicalize expressions that may be used as constants (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/const_string_test.dart
diff --git a/tests/language/const_string_test.dart b/tests/language/const_string_test.dart
index 4736ca49f12501a07e6f9b1335154e43b4053c16..13f1a9cb73a76632650dc38819d36b48a28d51ac 100644
--- a/tests/language/const_string_test.dart
+++ b/tests/language/const_string_test.dart
@@ -6,6 +6,8 @@ import "package:expect/expect.dart";
// Exercises compile-time string constants
+const yz = "y" + "z";
+
main() {
// Constant comparisons are independent of the quotes used.
Expect.isTrue(identical("abcd", 'abcd'));
@@ -34,4 +36,16 @@ main() {
Expect.isTrue(identical('a\'b\'cd', "a" "'b'" 'c' "d"));
Expect.isTrue(identical('a"b"cd', 'a' '"b"' 'c' "d"));
Expect.isTrue(identical("a\"b\"cd", 'a' '"b"' 'c' "d"));
+
+ const a = identical("ab", "a" + "b");
+ Expect.isTrue(a);
+
+ const b = identical("xyz", "x" + yz);
+ Expect.isTrue(b);
+
+ const c = identical("12", "1" "2");
+ Expect.isTrue(c);
+
+ const d = identical("zyz", "z$yz");
+ Expect.isTrue(d);
Lasse Reichstein Nielsen 2016/01/05 18:55:13 Maybe also test without the const declarations. An
Lasse Reichstein Nielsen 2016/01/05 18:56:15 (I think it will succeed after this patch, I just
hausner 2016/01/05 19:05:34 I've talked to Gilad about this. He said that the
}
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698