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

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

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 9 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
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.fixedLength(s.length); 29 List<int> a = new List(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.codeUnitAt(i); 33 a[i] = s.codeUnitAt(i);
34 ga.add(s.codeUnitAt(i)); 34 ga.add(s.codeUnitAt(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

Powered by Google App Engine
This is Rietveld 408576698