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

Side by Side Diff: tests/standalone/io/file_test.dart

Issue 11661003: Implement toString on File and Directory objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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) 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 // Dart test program for testing file I/O. 5 // Dart test program for testing file I/O.
6 6
7 import "dart:io"; 7 import "dart:io";
8 import "dart:isolate"; 8 import "dart:isolate";
9 9
10 class MyListOfOneElement implements List { 10 class MyListOfOneElement implements List {
(...skipping 26 matching lines...) Expand all
37 37
38 static void deleteTempDirectory() { 38 static void deleteTempDirectory() {
39 tempDirectory.deleteSync(recursive: true); 39 tempDirectory.deleteSync(recursive: true);
40 } 40 }
41 41
42 // Test for file read functionality. 42 // Test for file read functionality.
43 static void testReadStream() { 43 static void testReadStream() {
44 // Read a file and check part of it's contents. 44 // Read a file and check part of it's contents.
45 String filename = getFilename("bin/file_test.cc"); 45 String filename = getFilename("bin/file_test.cc");
46 File file = new File(filename); 46 File file = new File(filename);
47 Expect.isTrue('$file'.contains(file.name));
47 InputStream input = file.openInputStream(); 48 InputStream input = file.openInputStream();
48 input.onData = () { 49 input.onData = () {
49 List<int> buffer = new List<int>(42); 50 List<int> buffer = new List<int>(42);
50 int bytesRead = input.readInto(buffer, 0, 12); 51 int bytesRead = input.readInto(buffer, 0, 12);
51 Expect.equals(12, bytesRead); 52 Expect.equals(12, bytesRead);
52 bytesRead = input.readInto(buffer, 12, 30); 53 bytesRead = input.readInto(buffer, 12, 30);
53 input.close(); 54 input.close();
54 Expect.equals(30, bytesRead); 55 Expect.equals(30, bytesRead);
55 Expect.equals(47, buffer[0]); // represents '/' in the file. 56 Expect.equals(47, buffer[0]); // represents '/' in the file.
56 Expect.equals(47, buffer[1]); // represents '/' in the file. 57 Expect.equals(47, buffer[1]); // represents '/' in the file.
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 testDirectorySync(); 1329 testDirectorySync();
1329 testWriteStringUtf8(); 1330 testWriteStringUtf8();
1330 testWriteStringUtf8Sync(); 1331 testWriteStringUtf8Sync();
1331 }); 1332 });
1332 } 1333 }
1333 } 1334 }
1334 1335
1335 main() { 1336 main() {
1336 FileTest.testMain(); 1337 FileTest.testMain();
1337 } 1338 }
OLDNEW
« sdk/lib/io/file_impl.dart ('K') | « tests/standalone/io/directory_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698