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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/typechecker.dart ('k') | tests/language/language-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 main() { 5 main() {
6 { 6 {
7 // Generates identical compile time constants. 7 // Generates identical compile time constants.
8 var s1 = "abcdefgh"; 8 var s1 = "abcdefgh";
9 var s2 = "abcd" "efgh"; 9 var s2 = "abcd" "efgh";
10 var s3 = "ab" "cd" "ef" "gh"; 10 var s3 = "ab" "cd" "ef" "gh";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 var ms2 = """abc 47 var ms2 = """abc
48 def""" 48 def"""
49 """ 49 """
50 ghi 50 ghi
51 jkl 51 jkl
52 """; 52 """;
53 Expect.isTrue("abc\n def ghi\n jkl\n " === ms2, "Multiline: $ms2"); 53 Expect.isTrue("abc\n def ghi\n jkl\n " === ms2, "Multiline: $ms2");
54 54
55 // Binds stronger than property access (it's considered one literal). 55 // Binds stronger than property access (it's considered one literal).
56 Expect.equals(5, "ab" "cde".length, "Associativity"); 56 Expect.equals(5, "ab" "cde".length, "Associativity");
57
58 // Check that interpolations are handled correctly.
59 {
60 var x = "foo";
61 var y = 42;
62 var z = true;
63 String e1 = "$x$y$z";
64 Expect.equals(e1, "$x" "$y$z");
65 Expect.equals(e1, "$x$y" "$z");
66 Expect.equals(e1, "$x" "$y" "$z");
67 String e2 = "-$x-$y-$z-";
68 Expect.equals(e2, "-" "$x" "-" "$y" "-" "$z" "-", "a");
69 Expect.equals(e2, "-$x" "-" "$y" "-" "$z" "-", "b");
70 Expect.equals(e2, "-" "$x-" "$y" "-" "$z" "-", "c");
71 Expect.equals(e2, "-" "$x" "-$y" "-" "$z" "-", "d");
72 Expect.equals(e2, "-" "$x" "-" "$y-" "$z" "-", "e");
73 Expect.equals(e2, "-" "$x" "-" "$y" "-$z" "-", "f");
74 Expect.equals(e2, "-" "$x" "-" "$y" "-" "$z-", "g");
75 Expect.equals(e2, "-" "$x-$y" "-" "$z" "-", "h");
76 Expect.equals(e2, "-" "$x-$y-$z" "-", "i");
77
78 Expect.equals("-$x-$y-", "-" "$x" "-" "$y" "-");
79 Expect.equals("-$x-$y", "-" "$x" "-" "$y");
80 Expect.equals("-$x$y-", "-" "$x" "$y" "-");
81 Expect.equals("$x-$y-", "$x" "-" "$y" "-");
82
83 Expect.equals("$x$y", "$x" "$y");
84 Expect.equals("$x$y", "$x" "" "$y");
85 Expect.equals("$x$y", "$x" "" "" "$y");
86 Expect.equals("$x-$y", "$x" "-" "$y");
87 Expect.equals("$x-$y", "$x" "-" "" "$y");
88 Expect.equals("$x-$y", "$x" "" "-" "$y");
89 Expect.equals("$x-$y", "$x" "" "-" "" "$y");
90
91 Expect.equals("$x--$y", "$x" "-" "-" "$y");
92 Expect.equals("$x--$y", "$x" "-" "-" "" "$y");
93 Expect.equals("$x--$y", "$x" "-" "" "-" "$y");
94 Expect.equals("$x--$y", "$x" "" "-" "-" "$y");
95
96 Expect.equals("$x---$y", "$x" "-" "-" "-" "$y");
97 Expect.equals("$x---", "$x" "-" "-" "-");
98 Expect.equals("---$y", "-" "-" "-" "$y");
99
100 Expect.equals("$x-$y-$z", "${'$x' '-' '$y'}" "-" "$z");
101
102 Expect.equals(@"-foo-42-true-",
103 @"-" "$x" @"""-""" """$y""" @'-' '$z' @'''-''', "j");
104 Expect.equals(@"-$x-42-true-",
105 @"-" @"$x" @"""-""" """$y""" @'-' '$z' @'''-''', "k");
106 Expect.equals(@"-foo-$y-true-",
107 @"-" "$x" @"""-""" @"""$y""" @'-' '$z' @'''-''', "l");
108 Expect.equals(@"-foo-42-$z-",
109 @"-" "$x" @"""-""" """$y""" @'-' @'$z' @'''-''', "m");
110 }
57 } 111 }
OLDNEW
« no previous file with comments | « frog/leg/typechecker.dart ('k') | tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698