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

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

Issue 2989473002: Migrated test block 27 to Dart 2.0. (Closed)
Patch Set: Addressed Bob's nits and fixed test failures Created 3 years, 4 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
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 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 class StringBaseTest { 10 class StringBaseTest {
(...skipping 17 matching lines...) Expand all
28 static testCreation() { 28 static testCreation() {
29 String s = "Hello"; 29 String s = "Hello";
30 List<int> a = new List(s.length); 30 List<int> a = new List(s.length);
31 List<int> ga = new List(); 31 List<int> ga = new List();
32 bool exception_caught = false; 32 bool exception_caught = false;
33 for (int i = 0; i < a.length; i++) { 33 for (int i = 0; i < a.length; i++) {
34 a[i] = s.codeUnitAt(i); 34 a[i] = s.codeUnitAt(i);
35 ga.add(s.codeUnitAt(i)); 35 ga.add(s.codeUnitAt(i));
36 } 36 }
37 try { 37 try {
38 String s4 = new String.fromCharCodes([0.0]);
39 } on ArgumentError catch (ex) {
40 exception_caught = true;
41 } on TypeError catch (ex) {
42 exception_caught = true;
43 }
44 Expect.equals(true, exception_caught);
45 exception_caught = false;
46 try {
47 String s4 = new String.fromCharCodes([-1]); 38 String s4 = new String.fromCharCodes([-1]);
48 } on ArgumentError catch (ex) { 39 } on ArgumentError catch (ex) {
49 exception_caught = true; 40 exception_caught = true;
50 } 41 }
51 Expect.equals(true, exception_caught); 42 Expect.equals(true, exception_caught);
52 } 43 }
53 44
54 static testSubstring() { 45 static testSubstring() {
55 String s = "Hello World"; 46 String s = "Hello World";
56 Expect.equals("World", s.substring(6, s.length)); 47 Expect.equals("World", s.substring(6, s.length));
(...skipping 17 matching lines...) Expand all
74 static void testMain() { 65 static void testMain() {
75 testInterpolation(); 66 testInterpolation();
76 testCreation(); 67 testCreation();
77 testSubstring(); 68 testSubstring();
78 } 69 }
79 } 70 }
80 71
81 main() { 72 main() {
82 StringBaseTest.testMain(); 73 StringBaseTest.testMain();
83 } 74 }
OLDNEW
« no previous file with comments | « tests/corelib_2/string_base_vm_static_test.dart ('k') | tests/corelib_2/string_buffer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698