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

Unified Diff: tests/standalone/src/DirectoryTest.dart

Issue 8799009: Add support for client/dartc compilation only tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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
« no previous file with comments | « runtime/bin/directory_impl.dart ('k') | tools/test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/DirectoryTest.dart
diff --git a/tests/standalone/src/DirectoryTest.dart b/tests/standalone/src/DirectoryTest.dart
index 1b88340b6ccf16dddcbc34211677fee6f35d0988..66cbf92cc2bdf0604b328a6ec6a9cff7cfdf854c 100644
--- a/tests/standalone/src/DirectoryTest.dart
+++ b/tests/standalone/src/DirectoryTest.dart
@@ -6,38 +6,66 @@
class DirectoryTest {
static void testListing() {
- bool listedSomething = false;
- Directory directory = new Directory(".");
+ bool listedDir = false;
+ bool listedFile = false;
+
+ Directory directory = new Directory("/tmp/dart_temp_dir_");
Bill Hesse 2011/12/05 13:21:39 Surely this won't work on Windows, will it? Unles
Mads Ager (google) 2011/12/05 13:32:01 Thanks. I'll just use an empty string. I was copyi
+ directory.createTempSync();
+ Directory subDirectory = new Directory("${directory.path}/subdir");
+ Expect.isFalse(subDirectory.existsSync());
+ subDirectory.createSync();
+ File f = new File('${subDirectory.path}/file.txt');
+ Expect.isFalse(f.existsSync());
+ f.createSync();
directory.dirHandler = (dir) {
- listedSomething = true;
+ print(dir);
+ listedDir = true;
+ Expect.isTrue(dir.contains('dart_temp_dir'));
+ Expect.isTrue(dir.contains('subdir'));
};
directory.fileHandler = (f) {
- listedSomething = true;
+ print(f);
+ listedFile = true;
+ Expect.isTrue(f.contains('dart_temp_dir'));
+ Expect.isTrue(f.contains('subdir'));
+ Expect.isTrue(f.contains('file.txt'));
};
directory.doneHandler = (completed) {
Expect.isTrue(completed, "directory listing did not complete");
- Expect.isTrue(listedSomething, "empty directory");
+ Expect.isTrue(listedDir, "directory not found");
+ Expect.isTrue(listedFile, "file not found");
+ f.deleteHandler = () {
+ // TODO(ager): use async directory deletion API when available.
+ subDirectory.deleteSync();
+ directory.deleteSync();
+ };
+ f.delete();
};
directory.errorHandler = (error) {
Expect.fail("error listing directory: $error");
};
- directory.list();
+ directory.list(recursive: true);
// Listing is asynchronous, so nothing should be listed at this
// point.
- Expect.isFalse(listedSomething);
+ Expect.isFalse(listedDir);
+ Expect.isFalse(listedFile);
}
static void testExistsCreateDelete() {
- Directory d = new Directory("____DIRECTORY_TEST_DIRECTORY____");
- Expect.isFalse(d.existsSync());
- d.createSync();
+ Directory d = new Directory("/tmp/dart_temp_dir_");
+ d.createTempSync();
Expect.isTrue(d.existsSync());
+ Directory created = new Directory("${d.path}/subdir");
+ created.createSync();
+ Expect.isTrue(created.existsSync());
+ created.deleteSync();
+ Expect.isFalse(created.existsSync());
d.deleteSync();
Expect.isFalse(d.existsSync());
« no previous file with comments | « runtime/bin/directory_impl.dart ('k') | tools/test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698