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

Side by Side Diff: tests/standalone/io/socket_exception_test.dart

Issue 11275042: Renaming IndexOutOfRangeException to RangeError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 // 4 //
5 // Tests socket exceptions. 5 // Tests socket exceptions.
6 6
7 #import("dart:isolate"); 7 #import("dart:isolate");
8 #import("dart:io"); 8 #import("dart:io");
9 9
10 class SocketExceptionTest { 10 class SocketExceptionTest {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 ServerSocket server = new ServerSocket(HOST, PORT, 10); 122 ServerSocket server = new ServerSocket(HOST, PORT, 10);
123 Expect.equals(true, server !== null); 123 Expect.equals(true, server !== null);
124 int port = server.port; 124 int port = server.port;
125 Socket client = new Socket(HOST, port); 125 Socket client = new Socket(HOST, port);
126 client.onConnect = () { 126 client.onConnect = () {
127 Expect.equals(true, client !== null); 127 Expect.equals(true, client !== null);
128 try { 128 try {
129 List<int> buffer = new List<int>(10); 129 List<int> buffer = new List<int>(10);
130 client.readList(buffer, -1, 1); 130 client.readList(buffer, -1, 1);
131 } on IndexOutOfRangeException catch (ex) { 131 } on RangeError catch (ex) {
132 exceptionCaught = true; 132 exceptionCaught = true;
133 } on Exception catch (ex) { 133 } on Exception catch (ex) {
134 wrongExceptionCaught = true; 134 wrongExceptionCaught = true;
135 } 135 }
136 Expect.equals(true, exceptionCaught); 136 Expect.equals(true, exceptionCaught);
137 Expect.equals(true, !wrongExceptionCaught); 137 Expect.equals(true, !wrongExceptionCaught);
138 exceptionCaught = false; 138 exceptionCaught = false;
139 139
140 try { 140 try {
141 List<int> buffer = new List<int>(10); 141 List<int> buffer = new List<int>(10);
142 client.readList(buffer, 0, -1); 142 client.readList(buffer, 0, -1);
143 } on IndexOutOfRangeException catch (ex) { 143 } on RangeError catch (ex) {
144 exceptionCaught = true; 144 exceptionCaught = true;
145 } on Exception catch (ex) { 145 } on Exception catch (ex) {
146 wrongExceptionCaught = true; 146 wrongExceptionCaught = true;
147 } 147 }
148 Expect.equals(true, exceptionCaught); 148 Expect.equals(true, exceptionCaught);
149 Expect.equals(true, !wrongExceptionCaught); 149 Expect.equals(true, !wrongExceptionCaught);
150 exceptionCaught = false; 150 exceptionCaught = false;
151 151
152 try { 152 try {
153 List<int> buffer = new List<int>(10); 153 List<int> buffer = new List<int>(10);
154 client.writeList(buffer, -1, 1); 154 client.writeList(buffer, -1, 1);
155 } on IndexOutOfRangeException catch (ex) { 155 } on RangeError catch (ex) {
156 exceptionCaught = true; 156 exceptionCaught = true;
157 } on Exception catch (ex) { 157 } on Exception catch (ex) {
158 wrongExceptionCaught = true; 158 wrongExceptionCaught = true;
159 } 159 }
160 Expect.equals(true, exceptionCaught); 160 Expect.equals(true, exceptionCaught);
161 Expect.equals(true, !wrongExceptionCaught); 161 Expect.equals(true, !wrongExceptionCaught);
162 exceptionCaught = false; 162 exceptionCaught = false;
163 163
164 try { 164 try {
165 List<int> buffer = new List<int>(10); 165 List<int> buffer = new List<int>(10);
166 client.writeList(buffer, 0, -1); 166 client.writeList(buffer, 0, -1);
167 } on IndexOutOfRangeException catch (ex) { 167 } on RangeError catch (ex) {
168 exceptionCaught = true; 168 exceptionCaught = true;
169 } on Exception catch (ex) { 169 } on Exception catch (ex) {
170 wrongExceptionCaught = true; 170 wrongExceptionCaught = true;
171 } 171 }
172 Expect.equals(true, exceptionCaught); 172 Expect.equals(true, exceptionCaught);
173 Expect.equals(true, !wrongExceptionCaught); 173 Expect.equals(true, !wrongExceptionCaught);
174 174
175 server.close(); 175 server.close();
176 client.close(); 176 client.close();
177 }; 177 };
(...skipping 14 matching lines...) Expand all
192 clientSocketExceptionTest(); 192 clientSocketExceptionTest();
193 indexOutOfRangeExceptionTest(); 193 indexOutOfRangeExceptionTest();
194 unknownHostTest(); 194 unknownHostTest();
195 } 195 }
196 } 196 }
197 197
198 main() { 198 main() {
199 SocketExceptionTest.testMain(); 199 SocketExceptionTest.testMain();
200 } 200 }
201 201
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698