| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 // Tests for string interpolation | 7 // Tests for string interpolation |
| 8 class StringInterpolationTest { | 8 class StringInterpolationTest { |
| 9 | 9 |
| 10 StringInterpolationTest() {} | 10 StringInterpolationTest() {} |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // escaping $ - doesn't start the embedded expression | 53 // escaping $ - doesn't start the embedded expression |
| 54 Expect.equals("\$", "escaped \${3+2}"[12]); | 54 Expect.equals("\$", "escaped \${3+2}"[12]); |
| 55 Expect.equals("{", "escaped \${3+2}"[13]); | 55 Expect.equals("{", "escaped \${3+2}"[13]); |
| 56 Expect.equals("3", "escaped \${3+2}"[14]); | 56 Expect.equals("3", "escaped \${3+2}"[14]); |
| 57 Expect.equals("+", "escaped \${3+2}"[15]); | 57 Expect.equals("+", "escaped \${3+2}"[15]); |
| 58 Expect.equals("2", "escaped \${3+2}"[16]); | 58 Expect.equals("2", "escaped \${3+2}"[16]); |
| 59 Expect.equals("}", "escaped \${3+2}"[17]); | 59 Expect.equals("}", "escaped \${3+2}"[17]); |
| 60 | 60 |
| 61 if (alwaysFalse) { | 61 if (alwaysFalse) { |
| 62 "${i.toHorse()}"; /// 01: static type warning | 62 "${i.toHorse()}"; //# 01: static type warning |
| 63 } | 63 } |
| 64 | 64 |
| 65 Expect.equals("${m}", "$m"); | 65 Expect.equals("${m}", "$m"); |
| 66 } | 66 } |
| 67 | 67 |
| 68 String embedParams(int z) { | 68 String embedParams(int z) { |
| 69 return "param = ${z}"; | 69 return "param = ${z}"; |
| 70 } | 70 } |
| 71 | 71 |
| 72 String embedSingleField() { | 72 String embedSingleField() { |
| 73 return "j = ${j}"; | 73 return "j = ${j}"; |
| 74 } | 74 } |
| 75 | 75 |
| 76 String embedMultipleFields() { | 76 String embedMultipleFields() { |
| 77 return "j = ${j}; k = ${k}"; | 77 return "j = ${j}; k = ${k}"; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 main() { | 81 main() { |
| 82 StringInterpolationTest.testMain(false); | 82 StringInterpolationTest.testMain(false); |
| 83 } | 83 } |
| OLD | NEW |