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

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

Issue 2580133002: Fix directory existence query error (Closed)
Patch Set: Created 4 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 unified diff | Download patch
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:async"; 7 import "dart:async";
8 import "dart:io"; 8 import "dart:io";
9 9
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 596
597 597
598 testRename() { 598 testRename() {
599 var temp1 = Directory.systemTemp.createTempSync('directory_test'); 599 var temp1 = Directory.systemTemp.createTempSync('directory_test');
600 var temp2 = Directory.systemTemp.createTempSync('directory_test'); 600 var temp2 = Directory.systemTemp.createTempSync('directory_test');
601 var temp3 = temp1.renameSync(temp2.path); 601 var temp3 = temp1.renameSync(temp2.path);
602 Expect.isFalse(temp1.existsSync()); 602 Expect.isFalse(temp1.existsSync());
603 Expect.isTrue(temp2.existsSync()); 603 Expect.isTrue(temp2.existsSync());
604 Expect.equals(temp3.path, temp2.path); 604 Expect.equals(temp3.path, temp2.path);
605 605
606 temp2.rename(temp1.path).then((temp4) { 606 var temp4 = temp2.renameSync(temp1.path);
607 Expect.isFalse(temp3.existsSync()); 607 Expect.isFalse(temp3.existsSync());
608 Expect.isFalse(temp2.existsSync()); 608 Expect.isFalse(temp2.existsSync());
609 Expect.isTrue(temp1.existsSync()); 609 Expect.isTrue(temp1.existsSync());
610 Expect.isTrue(temp4.existsSync()); 610 Expect.isTrue(temp4.existsSync());
611 Expect.equals(temp1.path, temp4.path); 611 Expect.equals(temp1.path, temp4.path);
612 temp1.deleteSync(recursive: true); 612 temp1.deleteSync(recursive: true);
613 }); 613
614 var file = new File('${temp4.path}/foo');
615 try {
616 new Directory('${temp4.path}/foo').renameSync('${temp4.path}/bar');
617 Expect.fail('Directory.rename should fail to rename a non-directory');
618 } catch (e) {
619 Expect.isTrue(e is FileSystemException);
620 if (Platform.isLinux || Platform.isMacOS) {
621 Expect.isTrue(e.osError.message.contains('No such file or directory'));
622 }
623 }
614 } 624 }
615 625
616 main() { 626 main() {
617 DirectoryTest.testMain(); 627 DirectoryTest.testMain();
618 NestedTempDirectoryTest.testMain(); 628 NestedTempDirectoryTest.testMain();
619 testCreateTempErrorSync(); 629 testCreateTempErrorSync();
620 testCreateTempError(); 630 testCreateTempError();
621 testCreateExistingSync(); 631 testCreateExistingSync();
622 testCreateExisting(); 632 testCreateExisting();
623 testCreateDirExistingFileSync(); 633 testCreateDirExistingFileSync();
624 testCreateDirExistingFile(); 634 testCreateDirExistingFile();
625 testRename(); 635 testRename();
626 } 636 }
OLDNEW
« runtime/bin/directory_android.cc ('K') | « runtime/bin/directory_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698