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

Unified Diff: frog/tests/leg_only/src/LiteralStringJuxtapositionTest.dart

Issue 9642001: Make string juxtaposition combine properly with string interpolations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 8 years, 9 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
« frog/leg/tree/nodes.dart ('K') | « frog/leg/tree/nodes.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/tests/leg_only/src/LiteralStringJuxtapositionTest.dart
diff --git a/frog/tests/leg_only/src/LiteralStringJuxtapositionTest.dart b/frog/tests/leg_only/src/LiteralStringJuxtapositionTest.dart
index f2e914728f5fa4ec67751da14c730169b504f761..4405d82e07489b8f9b4191bc870a930a40ccbe6f 100644
--- a/frog/tests/leg_only/src/LiteralStringJuxtapositionTest.dart
+++ b/frog/tests/leg_only/src/LiteralStringJuxtapositionTest.dart
@@ -54,4 +54,58 @@ main() {
// Binds stronger than property access (it's considered one literal).
Expect.equals(5, "ab" "cde".length, "Associativity");
+
+ // Check that interpolations are handled correctly.
+ {
+ var x = "foo";
+ var y = 42;
+ var z = true;
+ String e1 = "$x$y$z";
+ Expect.equals(e1, "$x" "$y$z");
+ Expect.equals(e1, "$x$y" "$z");
+ Expect.equals(e1, "$x" "$y" "$z");
+ String e2 = "-$x-$y-$z-";
+ Expect.equals(e2, "-" "$x" "-" "$y" "-" "$z" "-", "a");
+ Expect.equals(e2, "-$x" "-" "$y" "-" "$z" "-", "b");
+ Expect.equals(e2, "-" "$x-" "$y" "-" "$z" "-", "c");
+ Expect.equals(e2, "-" "$x" "-$y" "-" "$z" "-", "d");
+ Expect.equals(e2, "-" "$x" "-" "$y-" "$z" "-", "e");
+ Expect.equals(e2, "-" "$x" "-" "$y" "-$z" "-", "f");
+ Expect.equals(e2, "-" "$x" "-" "$y" "-" "$z-", "g");
+ Expect.equals(e2, "-" "$x-$y" "-" "$z" "-", "h");
+ Expect.equals(e2, "-" "$x-$y-$z" "-", "i");
+
+ Expect.equals("-$x-$y-", "-" "$x" "-" "$y" "-");
+ Expect.equals("-$x-$y", "-" "$x" "-" "$y");
+ Expect.equals("-$x$y-", "-" "$x" "$y" "-");
+ Expect.equals("$x-$y-", "$x" "-" "$y" "-");
+
+ Expect.equals("$x$y", "$x" "$y");
+ Expect.equals("$x$y", "$x" "" "$y");
+ Expect.equals("$x$y", "$x" "" "" "$y");
+ Expect.equals("$x-$y", "$x" "-" "$y");
+ Expect.equals("$x-$y", "$x" "-" "" "$y");
+ Expect.equals("$x-$y", "$x" "" "-" "$y");
+ Expect.equals("$x-$y", "$x" "" "-" "" "$y");
+
+ Expect.equals("$x--$y", "$x" "-" "-" "$y");
+ Expect.equals("$x--$y", "$x" "-" "-" "" "$y");
+ Expect.equals("$x--$y", "$x" "-" "" "-" "$y");
+ Expect.equals("$x--$y", "$x" "" "-" "-" "$y");
+
+ Expect.equals("$x---$y", "$x" "-" "-" "-" "$y");
+ Expect.equals("$x---", "$x" "-" "-" "-");
+ Expect.equals("---$y", "-" "-" "-" "$y");
+
+ Expect.equals("$x-$y-$z", "${'$x' '-' '$y'}" "-" "$z");
+
+ Expect.equals(@"-foo-42-true-",
+ @"-" "$x" @"""-""" """$y""" @'-' '$z' @'''-''', "j");
+ Expect.equals(@"-$x-42-true-",
+ @"-" @"$x" @"""-""" """$y""" @'-' '$z' @'''-''', "j");
+ Expect.equals(@"-foo-$y-true-",
+ @"-" "$x" @"""-""" @"""$y""" @'-' '$z' @'''-''', "j");
+ Expect.equals(@"-foo-42-$z-",
+ @"-" "$x" @"""-""" """$y""" @'-' @'$z' @'''-''', "j");
+ }
}
« frog/leg/tree/nodes.dart ('K') | « frog/leg/tree/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698