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

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

Issue 10414046: Add support for directory renaming to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 8 years, 7 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
« no previous file with comments | « tests/standalone/io/directory_error_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:io"); 7 #import("dart:io");
8 #import("dart:isolate"); 8 #import("dart:isolate");
9 9
10 class DirectoryTest { 10 class DirectoryTest {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 testCreateTempError() { 400 testCreateTempError() {
401 var location = illegalTempDirectoryLocation(); 401 var location = illegalTempDirectoryLocation();
402 if (location == null) return; 402 if (location == null) return;
403 403
404 var port = new ReceivePort(); 404 var port = new ReceivePort();
405 var future = new Directory(location).createTemp(); 405 var future = new Directory(location).createTemp();
406 future.handleException((e) => port.close()); 406 future.handleException((e) => port.close());
407 } 407 }
408 408
409 409
410 testRename() {
411 var d = new Directory('');
412 var temp1 = d.createTempSync();
413 var temp2 = d.createTempSync();
414 var temp3 = temp1.renameSync(temp2.path);
415 Expect.isFalse(temp1.existsSync());
416 Expect.isTrue(temp2.existsSync());
417 Expect.equals(temp3.path, temp2.path);
418
419 temp2.rename(temp1.path).then((temp4) {
420 Expect.isFalse(temp3.existsSync());
421 Expect.isFalse(temp2.existsSync());
422 Expect.isTrue(temp1.existsSync());
423 Expect.isTrue(temp4.existsSync());
424 Expect.equals(temp1.path, temp4.path);
425 temp1.deleteRecursivelySync();
426 });
427 }
428
429
410 main() { 430 main() {
411 DirectoryTest.testMain(); 431 DirectoryTest.testMain();
412 NestedTempDirectoryTest.testMain(); 432 NestedTempDirectoryTest.testMain();
413 testCreateTempErrorSync(); 433 testCreateTempErrorSync();
414 testCreateTempError(); 434 testCreateTempError();
435 testRename();
415 } 436 }
OLDNEW
« no previous file with comments | « tests/standalone/io/directory_error_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698