| 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 FileInputStream, VM-only, standalone test. | 4 // Testing FileInputStream, VM-only, standalone test. |
| 5 | 5 |
| 6 // Helper method to be able to run the test from the runtime | 6 // Helper method to be able to run the test from the runtime |
| 7 // directory, or the top directory. | 7 // directory, or the top directory. |
| 8 String getFilename(String path) => | 8 String getFilename(String path) => |
| 9 FileUtil.fileExists(path) ? path : '../' + path; | 9 new File(path).existsSync() ? path : '../' + path; |
| 10 | 10 |
| 11 main() { | 11 main() { |
| 12 String fName = getFilename("tests/standalone/src/readuntil_test.dat"); | 12 String fName = getFilename("tests/standalone/src/readuntil_test.dat"); |
| 13 // File contains "Hello Dart\nwassup!" | 13 // File contains "Hello Dart\nwassup!" |
| 14 File file = new File(fName, false); | 14 File file = new File(fName); |
| 15 StringInputStream x = new StringInputStream(file.inputStream); | 15 file.openSync(); |
| 16 StringInputStream x = new StringInputStream(file.openInputStream()); |
| 16 String line = x.readLine(); | 17 String line = x.readLine(); |
| 17 Expect.equals("Hello Dart", line); | 18 Expect.equals("Hello Dart", line); |
| 18 file.close(); | 19 file.closeSync(); |
| 19 line = x.readLine(); | 20 line = x.readLine(); |
| 20 Expect.equals("wassup!", line); | 21 Expect.equals("wassup!", line); |
| 21 } | 22 } |
| OLD | NEW |