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

Side by Side Diff: tests/standalone/src/io/StringStreamTest.dart

Issue 9864051: Fix typo that has crept into string input stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « runtime/bin/string_stream.dart ('k') | no next file » | 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 4
5 #import("dart:io"); 5 #import("dart:io");
6 6
7 void testUtf8() { 7 void testUtf8() {
8 List<int> data = [0x01, 8 List<int> data = [0x01,
9 0x7f, 9 0x7f,
10 0xc2, 0x80, 10 0xc2, 0x80,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void streamClosed() { 158 void streamClosed() {
159 Expect.equals(4, stage); 159 Expect.equals(4, stage);
160 Expect.equals(true, stream.closed); 160 Expect.equals(true, stream.closed);
161 } 161 }
162 162
163 stream.onLine = stringData; 163 stream.onLine = stringData;
164 stream.onClosed = streamClosed; 164 stream.onClosed = streamClosed;
165 s.write("Line1\nLine2\r\nLine3\rLi".charCodes()); 165 s.write("Line1\nLine2\r\nLine3\rLi".charCodes());
166 } 166 }
167 167
168 class TestException {
169 TestException();
170 }
171
172 class ErrorInputStream implements InputStream {
173 ErrorInputStream();
174 List<int> read([int len]) => null;
175 int readInto(List<int> buffer, [int offset, int len]) => 0;
176 int available() => 0;
177 void pipe(OutputStream output, [bool close]){ }
178 void close() { }
179 bool get closed() => true;
180 void set onData(void callback()) { }
181 void set onClosed(void callback()) { }
182 void set onError(void callback(Exception e)) {
183 callback(new TestException());
184 }
185 }
186
187 testErrorHandler() {
188 var errors = 0;
189 var stream = new StringInputStream(new ErrorInputStream());
190 stream.onError = (e) {
191 errors++;
192 Expect.isTrue(e is TestException);
193 };
194 Expect.equals(1, errors);
195 }
196
168 main() { 197 main() {
169 testUtf8(); 198 testUtf8();
170 testLatin1(); 199 testLatin1();
171 testAscii(); 200 testAscii();
172 testReadLine1(); 201 testReadLine1();
173 testReadLine2(); 202 testReadLine2();
203 testErrorHandler();
174 } 204 }
OLDNEW
« no previous file with comments | « runtime/bin/string_stream.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698