| 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 // Dart test program testing string interpolation. | 4 // Dart test program testing string interpolation. |
| 5 | 5 |
| 6 | 6 |
| 7 class WhatchamaCallIt { | 7 class WhatchamaCallIt { |
| 8 WhatchamaCallIt() { } | 8 WhatchamaCallIt() { } |
| 9 | 9 |
| 10 String foo() { | 10 String foo() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 static String Printers; | 27 static String Printers; |
| 28 static String AAR_Printers; | 28 static String AAR_Printers; |
| 29 | 29 |
| 30 static testMain() { | 30 static testMain() { |
| 31 Printers = "Printers: $A and $B"; | 31 Printers = "Printers: $A and $B"; |
| 32 AAR_Printers = "AAR has $N $Printers."; | 32 AAR_Printers = "AAR has $N $Printers."; |
| 33 | 33 |
| 34 var x = 1; | 34 var x = 1; |
| 35 var s = "eins und \$x macht zwei."; | 35 var s = "eins und \$x macht zwei."; |
| 36 print(s); | 36 print(s); |
| 37 Expect.equals(@"eins und $x macht zwei.", s); | 37 Expect.equals(r"eins und $x macht zwei.", s); |
| 38 | 38 |
| 39 s = "eins und $x macht zwei."; | 39 s = "eins und $x macht zwei."; |
| 40 print(s); | 40 print(s); |
| 41 Expect.equals(@"eins und 1 macht zwei.", s); | 41 Expect.equals(r"eins und 1 macht zwei.", s); |
| 42 | 42 |
| 43 print(AAR_Printers); | 43 print(AAR_Printers); |
| 44 Expect.equals(@"AAR has 2 Printers: svin and hest.", AAR_Printers); | 44 Expect.equals(r"AAR has 2 Printers: svin and hest.", AAR_Printers); |
| 45 | 45 |
| 46 var s$eins = "eins"; | 46 var s$eins = "eins"; |
| 47 var $1 = 1; | 47 var $1 = 1; |
| 48 var zw = "zw"; | 48 var zw = "zw"; |
| 49 var ei = "ei"; | 49 var ei = "ei"; |
| 50 var zw$ei = "\"Martini, dry? Nai zwai.\""; | 50 var zw$ei = "\"Martini, dry? Nai zwai.\""; |
| 51 s = "${s$eins} und ${$1} macht $zw$ei."; | 51 s = "${s$eins} und ${$1} macht $zw$ei."; |
| 52 print(s); | 52 print(s); |
| 53 Expect.equals(@"eins und 1 macht zwei.", s); | 53 Expect.equals(r"eins und 1 macht zwei.", s); |
| 54 | 54 |
| 55 var t = new ThingamaBob("Gretel"); | 55 var t = new ThingamaBob("Gretel"); |
| 56 print(t.foo()); | 56 print(t.foo()); |
| 57 Expect.equals(t.foo(), "Hansel and Gretel"); | 57 Expect.equals(t.foo(), "Hansel and Gretel"); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 main() { | 61 main() { |
| 62 StringInterpolateTest.testMain(); | 62 StringInterpolateTest.testMain(); |
| 63 } | 63 } |
| OLD | NEW |