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

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

Issue 8399033: First round of changes to the file interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 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) 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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698