| OLD | NEW |
| 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 Loading... |
| 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 Expect.equals("$x--$y", "$x" "-" "-" "$y"); |
| 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-$z", "${'$x' '-' '$y'}" "-" "$z"); |
| 97 |
| 98 Expect.equals(@"-foo-42-true-", |
| 99 @"-" "$x" @"""-""" """$y""" @'-' '$z' @'''-''', "j"); |
| 100 Expect.equals(@"-$x-42-true-", |
| 101 @"-" @"$x" @"""-""" """$y""" @'-' '$z' @'''-''', "j"); |
| 102 Expect.equals(@"-foo-$y-true-", |
| 103 @"-" "$x" @"""-""" @"""$y""" @'-' '$z' @'''-''', "j"); |
| 104 Expect.equals(@"-foo-42-$z-", |
| 105 @"-" "$x" @"""-""" """$y""" @'-' @'$z' @'''-''', "j"); |
| 106 } |
| 57 } | 107 } |
| OLD | NEW |