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

Unified Diff: tests/standalone/io/directory_test.dart

Issue 11748017: Add synchronous directory listing to dart:io Directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, move tests that fail on Windows due to VM bug 7157 to a separate test file. 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 side-by-side diff with in-line comments
Download patch
Index: tests/standalone/io/directory_test.dart
diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart
index baf506efc5ea7c607923fd7de5e67a92d357f54c..825cb9cf285386222808f9b994fc0ae291275395 100644
--- a/tests/standalone/io/directory_test.dart
+++ b/tests/standalone/io/directory_test.dart
@@ -22,6 +22,31 @@ class DirectoryTest {
Expect.isFalse(f.existsSync());
f.createSync();
+ void testSyncListing(bool recursive) {
+ for (var entry in directory.listSync(recursive: recursive)) {
+ if (entry is File) {
+ Expect.isTrue(entry.name.contains(directory.path));
+ Expect.isTrue(entry.name.contains('subdir'));
+ Expect.isTrue(entry.name.contains('file.txt'));
+ Expect.isFalse(listedFile);
+ listedFile = true;
+ } else {
+ Expect.isTrue(entry is Directory);
+ Expect.isTrue(entry.path.contains(directory.path));
+ Expect.isTrue(entry.path.contains('subdir'));
+ Expect.isFalse(listedDir);
+ listedDir = true;
+ }
+ }
+ Expect.equals(listedFile, recursive);
+ Expect.isTrue(listedDir);
+ listedFile = false;
+ listedDir = false;
+ }
+
+ testSyncListing(true);
+ testSyncListing(false);
+
var lister = directory.list(recursive: true);
lister.onDir = (dir) {
« no previous file with comments | « tests/standalone/io/directory_list_nonexistent_test.dart ('k') | tests/standalone/io/file_system_links_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698