| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Tests for string interpolation | 5 // Tests for string interpolation |
| 6 class StringInterpolationTest { | 6 class StringInterpolationTest { |
| 7 | 7 |
| 8 StringInterpolationTest() {} | 8 StringInterpolationTest() {} |
| 9 | 9 |
| 10 static final int i = 1; | 10 static final int i = 1; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 var c4 = '4'; | 27 var c4 = '4'; |
| 28 // no chars before/after/between embedded expressions | 28 // no chars before/after/between embedded expressions |
| 29 Expect.equals(" 1", " ${c1}"); | 29 Expect.equals(" 1", " ${c1}"); |
| 30 Expect.equals("1 ", "${c1} "); | 30 Expect.equals("1 ", "${c1} "); |
| 31 Expect.equals("1", "${c1}"); | 31 Expect.equals("1", "${c1}"); |
| 32 Expect.equals("12", "${c1}${c2}"); | 32 Expect.equals("12", "${c1}${c2}"); |
| 33 Expect.equals("12 34", "${c1}${c2} ${c3}${c4}"); | 33 Expect.equals("12 34", "${c1}${c2} ${c3}${c4}"); |
| 34 | 34 |
| 35 // embedding static fields | 35 // embedding static fields |
| 36 Expect.equals(" hi 1 ", " hi ${i} "); | 36 Expect.equals(" hi 1 ", " hi ${i} "); |
| 37 Expect.equals(true, " hi ${i} " === " hi ${i} "); | |
| 38 Expect.equals(" hi <hi> ", " hi ${a} "); | 37 Expect.equals(" hi <hi> ", " hi ${a} "); |
| 39 | 38 |
| 40 // embedding method parameters | 39 // embedding method parameters |
| 41 Expect.equals("param = 9", test.embedParams(9)); | 40 Expect.equals("param = 9", test.embedParams(9)); |
| 42 | 41 |
| 43 // embedding a class field | 42 // embedding a class field |
| 44 Expect.equals("j = 3", test.embedSingleField()); | 43 Expect.equals("j = 3", test.embedSingleField()); |
| 45 | 44 |
| 46 // embedding more than one (non-constant) expression | 45 // embedding more than one (non-constant) expression |
| 47 Expect.equals(" hi 1 <hi>", " hi ${i} ${a}"); | 46 Expect.equals(" hi 1 <hi>", " hi ${i} ${a}"); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 69 } | 68 } |
| 70 | 69 |
| 71 String embedMultipleFields() { | 70 String embedMultipleFields() { |
| 72 return "j = ${j}; k = ${k}"; | 71 return "j = ${j}; k = ${k}"; |
| 73 } | 72 } |
| 74 } | 73 } |
| 75 | 74 |
| 76 main() { | 75 main() { |
| 77 StringInterpolationTest.testMain(false); | 76 StringInterpolationTest.testMain(false); |
| 78 } | 77 } |
| OLD | NEW |