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

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

Issue 12208109: Remove erroneous assert from Windows implementation of dart:io File.fullPath. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: underscores, not dashes Created 7 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/file_win.cc ('K') | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/directory_test.dart
diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart
index 8c28a2467f1f5c986781442b77b86178452cacfd..8a3776a3ade0883e55810c2eedf20ce3f7b5e9bb 100644
--- a/tests/standalone/io/directory_test.dart
+++ b/tests/standalone/io/directory_test.dart
@@ -4,6 +4,7 @@
//
// Directory listing test.
+import "dart:async";
import "dart:io";
import "dart:isolate";
@@ -19,6 +20,7 @@ class DirectoryTest {
subDirectory.createSync();
Expect.isTrue(subDirectory.existsSync());
File f = new File('${subDirectory.path}/file.txt');
+ File fLong = new File('${directory.path}/subdir/../subdir/file.txt');
Expect.isFalse(f.existsSync());
f.createSync();
@@ -46,6 +48,7 @@ class DirectoryTest {
testSyncListing(true);
testSyncListing(false);
+ Expect.equals(f.fullPathSync(), fLong.fullPathSync());
var lister = directory.list(recursive: true);
@@ -288,71 +291,24 @@ class DirectoryTest {
Expect.isFalse(d.existsSync());
}
- static void testCreateTemp() {
- Directory tempDir1;
- Directory tempDir2;
- bool stage1aDone = false;
- bool stage1bDone = false;
- bool emptyTemplateTestRunning = false;
-
- // Stages 0 through 2 run twice, the second time with an empty path.
- Function stage0;
- Function stage1a;
- Function stage1b;
- Function stage2;
- Function stage3; // Loops to stage 0.
-
- stage0 = () {
- var dir = new Directory("/tmp/dart_temp_dir_");
- dir.createTemp().then(stage1a);
- dir.createTemp().then(stage1b);
- };
-
- stage1a = (temp) {
- tempDir1 = temp;
- stage1aDone = true;
- Expect.isTrue(tempDir1.existsSync());
- if (stage1bDone) {
- stage2();
- }
- };
-
- stage1b = (temp) {
- tempDir2 = temp;
- stage1bDone = true;
- Expect.isTrue(tempDir2.existsSync());
- if (stage1aDone) {
- stage2();
- }
- };
-
- stage2 = () {
- Expect.notEquals(tempDir1.path, tempDir2.path);
- tempDir1.deleteSync();
- tempDir2.deleteSync();
- Expect.isFalse(tempDir1.existsSync());
- Expect.isFalse(tempDir2.existsSync());
- if (!emptyTemplateTestRunning) {
- emptyTemplateTestRunning = true;
- stage3();
- } else {
- // Done with test.
- }
- };
-
- stage3 = () {
- tempDir1 = new Directory("");
- tempDir2 = new Directory("");
- stage1aDone = false;
- stage1bDone = false;
- stage0();
- };
+ static void testCreateTemp([String template = ""]) {
+ var port = new ReceivePort();
+ Directory dir = new Directory(template);
+ Future.wait([dir.createTemp(), dir.createTemp()])
+ .then((tempDirs) {
+ Expect.notEquals(tempDirs[0].path, tempDirs[1].path);
+ for (Directory t in tempDirs) {
+ Expect.isTrue(t.existsSync());
+ t.deleteSync();
+ Expect.isFalse(t.existsSync());
+ }
+ port.close();
+ });
+ }
+ static void testCreateTempTemplate() {
if (new Directory("/tmp").existsSync()) {
- stage0();
- } else {
- emptyTemplateTestRunning = true;
- stage3();
+ testCreateTemp("/tmp/dart_temp_dir_");
}
}
« runtime/bin/file_win.cc ('K') | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698