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

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

Issue 17265003: Avoid double-// on directory listing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 // Directory listing test. 5 // Directory listing test.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "dart:async"; 8 import "dart:async";
9 import "dart:io"; 9 import "dart:io";
10 import "dart:isolate"; 10 import "dart:isolate";
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 listingDonePort.close(); 78 listingDonePort.close();
79 }); 79 });
80 }); 80 });
81 81
82 // Listing is asynchronous, so nothing should be listed at this 82 // Listing is asynchronous, so nothing should be listed at this
83 // point. 83 // point.
84 Expect.isFalse(listedDir); 84 Expect.isFalse(listedDir);
85 Expect.isFalse(listedFile); 85 Expect.isFalse(listedFile);
86 } 86 }
87 87
88 static void testListingTailingPaths() {
89 Directory directory = new Directory("").createTempSync();
90 Directory subDirectory = new Directory("${directory.path}/subdir/");
91 subDirectory.createSync();
92 File f = new File('${subDirectory.path}/file.txt');
93 f.createSync();
94
95 void test(entry) {
96 Expect.isFalse(entry.path.contains(new RegExp('[\\/][\\/]')));
97 }
98
99 subDirectory.listSync().forEach(test);
100
101 subDirectory.list().listen(test, onDone: () {
102 directory.deleteSync(recursive: true);
103 });
104 }
105
88 static void testListNonExistent() { 106 static void testListNonExistent() {
89 setupListerHandlers(Stream<FileSystemEntity> stream) { 107 setupListerHandlers(Stream<FileSystemEntity> stream) {
90 stream.listen( 108 stream.listen(
91 (_) => Expect.fail("Listing of non-existing directory should fail"), 109 (_) => Expect.fail("Listing of non-existing directory should fail"),
92 onError: (error) { 110 onError: (error) {
93 Expect.isTrue(error is DirectoryException); 111 Expect.isTrue(error is DirectoryException);
94 }); 112 });
95 } 113 }
96 new Directory("").createTemp().then((d) { 114 new Directory("").createTemp().then((d) {
97 d.delete().then((ignore) { 115 d.delete().then((ignore) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 var name = new File('.').fullPathSync(); 408 var name = new File('.').fullPathSync();
391 Directory current1 = new Directory(name); 409 Directory current1 = new Directory(name);
392 var path = new Path(name); 410 var path = new Path(name);
393 Directory current2 = new Directory.fromPath(path); 411 Directory current2 = new Directory.fromPath(path);
394 Expect.equals(current1.path, current2.path); 412 Expect.equals(current1.path, current2.path);
395 Expect.isTrue(current1.existsSync()); 413 Expect.isTrue(current1.existsSync());
396 } 414 }
397 415
398 static void testMain() { 416 static void testMain() {
399 testListing(); 417 testListing();
418 testListingTailingPaths();
400 testListNonExistent(); 419 testListNonExistent();
401 testListTooLongName(); 420 testListTooLongName();
402 testDeleteNonExistent(); 421 testDeleteNonExistent();
403 testDeleteTooLongName(); 422 testDeleteTooLongName();
404 testDeleteNonExistentSync(); 423 testDeleteNonExistentSync();
405 testDeleteTooLongNameSync(); 424 testDeleteTooLongNameSync();
406 testExistsCreateDelete(); 425 testExistsCreateDelete();
407 testExistsCreateDeleteSync(); 426 testExistsCreateDeleteSync();
408 testDeleteLinkSync(); 427 testDeleteLinkSync();
409 testDeleteLinkAsFileSync(); 428 testDeleteLinkAsFileSync();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 testCreateTempErrorSync(); 634 testCreateTempErrorSync();
616 testCreateTempError(); 635 testCreateTempError();
617 testCreateExistingSync(); 636 testCreateExistingSync();
618 testCreateExisting(); 637 testCreateExisting();
619 testCreateDirExistingFileSync(); 638 testCreateDirExistingFileSync();
620 testCreateDirExistingFile(); 639 testCreateDirExistingFile();
621 testCreateRecursive(); 640 testCreateRecursive();
622 testCreateRecursiveSync(); 641 testCreateRecursiveSync();
623 testRename(); 642 testRename();
624 } 643 }
OLDNEW
« sdk/lib/io/directory_impl.dart ('K') | « sdk/lib/io/directory_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698