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

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

Issue 10891020: Update almost all tests (except co19) to use the new try-catch syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. Created 8 years, 3 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/set_iterator_test.dart ('k') | tests/corelib/string_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) 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 for testing class 'StringBase' (currently VM specific). 4 // Dart test program for testing class 'StringBase' (currently VM specific).
5 5
6 #library("StringBaseTest.dart"); 6 #library("StringBaseTest.dart");
7 #import("dart:coreimpl"); 7 #import("dart:coreimpl");
8 8
9 9
10 class StringBaseTest { 10 class StringBaseTest {
(...skipping 30 matching lines...) Expand all
41 for (int i = 0; i < a.length; i++) { 41 for (int i = 0; i < a.length; i++) {
42 a[i] = s.charCodeAt(i); 42 a[i] = s.charCodeAt(i);
43 ga.add(s.charCodeAt(i)); 43 ga.add(s.charCodeAt(i));
44 } 44 }
45 String s2 = StringBase.createFromCharCodes(a); 45 String s2 = StringBase.createFromCharCodes(a);
46 Expect.equals(s, s2); 46 Expect.equals(s, s2);
47 String s3 = StringBase.createFromCharCodes(ga); 47 String s3 = StringBase.createFromCharCodes(ga);
48 Expect.equals(s, s3); 48 Expect.equals(s, s3);
49 try { 49 try {
50 String s4 = new String.fromCharCodes([0.0]); 50 String s4 = new String.fromCharCodes([0.0]);
51 } catch (IllegalArgumentException ex) { 51 } on IllegalArgumentException catch (ex) {
52 exception_caught = true; 52 exception_caught = true;
53 } 53 }
54 Expect.equals(true, exception_caught); 54 Expect.equals(true, exception_caught);
55 exception_caught = false; 55 exception_caught = false;
56 try { 56 try {
57 String s4 = new String.fromCharCodes([-1]); 57 String s4 = new String.fromCharCodes([-1]);
58 } catch (IllegalArgumentException ex) { 58 } on IllegalArgumentException catch (ex) {
59 exception_caught = true; 59 exception_caught = true;
60 } 60 }
61 Expect.equals(true, exception_caught); 61 Expect.equals(true, exception_caught);
62 } 62 }
63 63
64 static testSubstring() { 64 static testSubstring() {
65 String s = "Hello World"; 65 String s = "Hello World";
66 Expect.equals("World", s.substring(6, s.length)); 66 Expect.equals("World", s.substring(6, s.length));
67 Expect.equals("", s.substring(8, 8)); 67 Expect.equals("", s.substring(8, 8));
68 bool exception_caught = false; 68 bool exception_caught = false;
69 try { 69 try {
70 s.substring(5, 12); 70 s.substring(5, 12);
71 } catch (IndexOutOfRangeException ex) { 71 } on IndexOutOfRangeException catch (ex) {
72 exception_caught = true; 72 exception_caught = true;
73 } 73 }
74 Expect.equals(true, exception_caught); 74 Expect.equals(true, exception_caught);
75 exception_caught = false; 75 exception_caught = false;
76 try { 76 try {
77 s.substring(5, 4); 77 s.substring(5, 4);
78 } catch (IndexOutOfRangeException ex) { 78 } on IndexOutOfRangeException catch (ex) {
79 exception_caught = true; 79 exception_caught = true;
80 } 80 }
81 Expect.equals(true, exception_caught); 81 Expect.equals(true, exception_caught);
82 } 82 }
83 83
84 static void testMain() { 84 static void testMain() {
85 testSubstringMatches(); 85 testSubstringMatches();
86 testInterpolation(); 86 testInterpolation();
87 testCreation(); 87 testCreation();
88 testSubstring(); 88 testSubstring();
89 } 89 }
90 } 90 }
91 91
92 main() { 92 main() {
93 StringBaseTest.testMain(); 93 StringBaseTest.testMain();
94 } 94 }
OLDNEW
« no previous file with comments | « tests/corelib/set_iterator_test.dart ('k') | tests/corelib/string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698