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

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

Issue 9452009: Fix bug in Directory after porting to using native ports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« no previous file with comments | « runtime/bin/directory_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Directory listing test. 5 // Directory listing test.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 8
9 class DirectoryTest { 9 class DirectoryTest {
10 static void testListing() { 10 static void testListing() {
11 bool listedDir = false; 11 bool listedDir = false;
12 bool listedFile = false; 12 bool listedFile = false;
13 13
14 Directory directory = new Directory(""); 14 Directory directory = new Directory("");
15 directory.createTempSync(); 15 directory.createTempSync();
16 Directory subDirectory = new Directory("${directory.path}/subdir"); 16 Directory subDirectory = new Directory("${directory.path}/subdir");
17 Expect.isFalse(subDirectory.existsSync()); 17 Expect.isFalse(subDirectory.existsSync());
18 subDirectory.createSync(); 18 subDirectory.createSync();
19 File f = new File('${subDirectory.path}/file.txt'); 19 File f = new File('${subDirectory.path}/file.txt');
20 Expect.isFalse(f.existsSync()); 20 Expect.isFalse(f.existsSync());
21 f.createSync(); 21 f.createSync();
22 22
23 directory.dirHandler = (dir) { 23 directory.dirHandler = (dir) {
24 listedDir = true; 24 listedDir = true;
25 Expect.isTrue(dir.contains(directory.path));
25 Expect.isTrue(dir.contains('subdir')); 26 Expect.isTrue(dir.contains('subdir'));
26 }; 27 };
27 28
28 directory.fileHandler = (f) { 29 directory.fileHandler = (f) {
29 listedFile = true; 30 listedFile = true;
31 Expect.isTrue(f.contains(directory.path));
30 Expect.isTrue(f.contains('subdir')); 32 Expect.isTrue(f.contains('subdir'));
31 Expect.isTrue(f.contains('file.txt')); 33 Expect.isTrue(f.contains('file.txt'));
32 }; 34 };
33 35
34 directory.doneHandler = (completed) { 36 directory.doneHandler = (completed) {
35 Expect.isTrue(completed, "directory listing did not complete"); 37 Expect.isTrue(completed, "directory listing did not complete");
36 Expect.isTrue(listedDir, "directory not found"); 38 Expect.isTrue(listedDir, "directory not found");
37 Expect.isTrue(listedFile, "file not found"); 39 Expect.isTrue(listedFile, "file not found");
38 directory.delete(recursive: true); 40 directory.delete(recursive: true);
39 directory.deleteHandler = () { 41 directory.deleteHandler = () {
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 dir.createTemp(); 476 dir.createTemp();
475 } 477 }
476 478
477 479
478 main() { 480 main() {
479 DirectoryTest.testMain(); 481 DirectoryTest.testMain();
480 NestedTempDirectoryTest.testMain(); 482 NestedTempDirectoryTest.testMain();
481 testCreateTempErrorSync(); 483 testCreateTempErrorSync();
482 testCreateTempError(); 484 testCreateTempError();
483 } 485 }
OLDNEW
« no previous file with comments | « runtime/bin/directory_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698