OLD | NEW |
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 // Testing file input stream, VM-only, standalone test. | 4 // Testing file input stream, VM-only, standalone test. |
5 | 5 |
| 6 #import("dart:io"); |
| 7 |
6 // Helper method to be able to run the test from the runtime | 8 // Helper method to be able to run the test from the runtime |
7 // directory, or the top directory. | 9 // directory, or the top directory. |
8 String getFilename(String path) => | 10 String getFilename(String path) => |
9 new File(path).existsSync() ? path : '../' + path; | 11 new File(path).existsSync() ? path : '../' + path; |
10 | 12 |
11 void testStringInputStreamSync() { | 13 void testStringInputStreamSync() { |
12 String fileName = getFilename("tests/standalone/src/readuntil_test.dat"); | 14 String fileName = getFilename("tests/standalone/src/readuntil_test.dat"); |
13 // File contains "Hello Dart\nwassup!\n" | 15 // File contains "Hello Dart\nwassup!\n" |
14 File file = new File(fileName); | 16 File file = new File(fileName); |
15 StringInputStream x = new StringInputStream(file.openInputStream()); | 17 StringInputStream x = new StringInputStream(file.openInputStream()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 main() { | 83 main() { |
82 testStringInputStreamSync(); | 84 testStringInputStreamSync(); |
83 testInputStreamAsync(); | 85 testInputStreamAsync(); |
84 // Check the length of these files as both are text files where one | 86 // Check the length of these files as both are text files where one |
85 // is without a terminating line separator which can easily be added | 87 // is without a terminating line separator which can easily be added |
86 // back if accidentally opened in a text editor. | 88 // back if accidentally opened in a text editor. |
87 testStringInputStreamAsync("readline_test1.dat", 111); | 89 testStringInputStreamAsync("readline_test1.dat", 111); |
88 testStringInputStreamAsync("readline_test2.dat", 114); | 90 testStringInputStreamAsync("readline_test2.dat", 114); |
89 testChunkedInputStream(); | 91 testChunkedInputStream(); |
90 } | 92 } |
OLD | NEW |