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

Side by Side Diff: tests/standalone/src/ReadIntoConstList.dart

Issue 9029001: Add close to input stream and cleanup socket and streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments by ager@ Created 8 years, 11 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) 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 4
5 // Regression test for missing immutability check in the ListSet 5 // Regression test for missing immutability check in the ListSet
6 // methods in the API. This allowed overwriting const Lists. 6 // methods in the API. This allowed overwriting const Lists.
7 7
8 String getFilename(String path) => 8 String getFilename(String path) =>
9 new File(path).existsSync() ? path : 'runtime/' + path; 9 new File(path).existsSync() ? path : 'runtime/' + path;
10 10
11 void main() { 11 void main() {
12 var a = const [0]; 12 var a = const [0];
13 var b = const [0]; 13 var b = const [0];
14 Expect.isTrue(a === b); 14 Expect.isTrue(a === b);
15 15
16 String filename = getFilename("bin/file_test.cc"); 16 String filename = getFilename("bin/file_test.cc");
17 File file = new File(filename); 17 File file = new File(filename);
18 FileInputStream input = file.openInputStream(); 18 InputStream input = file.openInputStream();
19 try { 19 try {
20 input.readInto(a, 0, 1); 20 input.readInto(a, 0, 1);
21 Expect.fail("no exception thrown"); 21 Expect.fail("no exception thrown");
22 } catch (var e) { 22 } catch (var e) {
23 Expect.isTrue(e is FileIOException); 23 Expect.isTrue(e is FileIOException);
24 } 24 }
25 Expect.equals(0, a[0]); 25 Expect.equals(0, a[0]);
26 Expect.equals(0, b[0]); 26 Expect.equals(0, b[0]);
27 } 27 }
OLDNEW
« no previous file with comments | « tests/standalone/src/ListInputStreamTest.dart ('k') | tests/standalone/src/SocketCloseTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698