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

Side by Side Diff: tests/language/src/StringInterpolateTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program testing string interpolation.
5
6
7 class WhatchamaCallIt {
8 WhatchamaCallIt() { }
9
10 String foo() {
11 // Test $this and Field name is defined in subclass.
12 return "$this and $name";
13 }
14 }
15
16 class ThingamaBob extends WhatchamaCallIt {
17 ThingamaBob(String s) : super(), name = s { }
18 String name;
19 toString() => "Hansel";
20 }
21
22 class StringInterpolateTest {
23
24 static final String A = "svin";
25 static final String B = "hest";
26 static final int N = 1 + 1;
27 static String Printers;
28 static String AAR_Printers;
29
30 static testMain() {
31 Printers = "Printers: $A and $B";
32 AAR_Printers = "AAR has $N $Printers.";
33
34 var x = 1;
35 var s = "eins und \$x macht zwei.";
36 print(s);
37 Expect.equals(@"eins und $x macht zwei.", s);
38
39 s = "eins und $x macht zwei.";
40 print(s);
41 Expect.equals(@"eins und 1 macht zwei.", s);
42
43 print(AAR_Printers);
44 Expect.equals(@"AAR has 2 Printers: svin and hest.", AAR_Printers);
45
46 var s$eins = "eins";
47 var $1 = 1;
48 var zw = "zw";
49 var ei = "ei";
50 var zw$ei = "\"Martini, dry? Nai zwai.\"";
51 s = "${s$eins} und ${$1} macht $zw$ei.";
52 print(s);
53 Expect.equals(@"eins und 1 macht zwei.", s);
54
55 var t = new ThingamaBob("Gretel");
56 print(t.foo());
57 Expect.equals(t.foo(), "Hansel and Gretel");
58 }
59 }
60
61 main() {
62 StringInterpolateTest.testMain();
63 }
OLDNEW
« no previous file with comments | « tests/language/src/StringInterpolateNPETest.dart ('k') | tests/language/src/StringInterpolation1NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698