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

Side by Side Diff: tests/corelib/string_base_vm_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « tests/corelib/stopwatch_test.dart ('k') | tests/corelib/string_character_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Dart test program for testing class 'StringBase' (currently VM specific). 4 // Dart test program for testing class 'StringBase' (currently VM specific).
5 5
6 library string_base_test; 6 library string_base_test;
7 7
8 class StringBaseTest { 8 class StringBaseTest {
9 9
10 StringBaseTest() {} 10 StringBaseTest() {}
11 11
12 toString() { 12 toString() {
13 return "StringBase Tester"; 13 return "StringBase Tester";
14 } 14 }
15 15
16 static testInterpolation() { 16 static testInterpolation() {
17 var answer = 40 + 2; 17 var answer = 40 + 2;
18 var s = "The answer is $answer."; 18 var s = "The answer is $answer.";
19 Expect.equals("The answer is 42.", s); 19 Expect.equals("The answer is 42.", s);
20 20
21 int numBottles = 33; 21 int numBottles = 33;
22 String wall = "wall"; 22 String wall = "wall";
23 s = "${numBottles*3} bottles of beer on the $wall."; 23 s = "${numBottles*3} bottles of beer on the $wall.";
24 Expect.equals("99 bottles of beer on the wall.", s); 24 Expect.equals("99 bottles of beer on the wall.", s);
25 } 25 }
26 26
27 static testCreation() { 27 static testCreation() {
28 String s = "Hello"; 28 String s = "Hello";
29 List<int> a = new List(s.length); 29 List<int> a = new List.fixedLength(s.length);
30 List<int> ga = new List(); 30 List<int> ga = new List();
31 bool exception_caught = false; 31 bool exception_caught = false;
32 for (int i = 0; i < a.length; i++) { 32 for (int i = 0; i < a.length; i++) {
33 a[i] = s.charCodeAt(i); 33 a[i] = s.charCodeAt(i);
34 ga.add(s.charCodeAt(i)); 34 ga.add(s.charCodeAt(i));
35 } 35 }
36 try { 36 try {
37 String s4 = new String.fromCharCodes([0.0]); 37 String s4 = new String.fromCharCodes([0.0]);
38 } on ArgumentError catch (ex) { 38 } on ArgumentError catch (ex) {
39 exception_caught = true; 39 exception_caught = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 static void testMain() { 71 static void testMain() {
72 testInterpolation(); 72 testInterpolation();
73 testCreation(); 73 testCreation();
74 testSubstring(); 74 testSubstring();
75 } 75 }
76 } 76 }
77 77
78 main() { 78 main() {
79 StringBaseTest.testMain(); 79 StringBaseTest.testMain();
80 } 80 }
OLDNEW
« no previous file with comments | « tests/corelib/stopwatch_test.dart ('k') | tests/corelib/string_character_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698