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

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

Issue 10639004: Add .fromPath constructors to File and Directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 }); 313 });
314 } 314 }
315 315
316 static void testCurrent() { 316 static void testCurrent() {
317 Directory current = new Directory.current(); 317 Directory current = new Directory.current();
318 if (Platform.operatingSystem != "windows") { 318 if (Platform.operatingSystem != "windows") {
319 Expect.equals("/", current.path.substring(0, 1)); 319 Expect.equals("/", current.path.substring(0, 1));
320 } 320 }
321 } 321 }
322 322
323 static void testFromPath() {
324 Directory current = new Directory.fromPath(new Path('.'));
Bill Hesse 2012/06/21 16:02:58 Remove current - it is not used.
Mads Ager (google) 2012/06/22 07:44:36 Please do. Instead of adding comments to your code
Bill Hesse 2012/06/22 10:35:33 Done.
325 var name = new File('.').fullPathSync();
326 Directory current1 = new Directory(name);
327 var path = new Path.fromNative(name);
328 Directory current2 = new Directory.fromPath(path);
329 Expect.equals(current1.path, current2.path);
330 Expect.isTrue(current1.existsSync());
331 }
332
323 static void testMain() { 333 static void testMain() {
324 testListing(); 334 testListing();
325 testListNonExistent(); 335 testListNonExistent();
326 testListTooLongName(); 336 testListTooLongName();
327 testDeleteNonExistent(); 337 testDeleteNonExistent();
328 testDeleteTooLongName(); 338 testDeleteTooLongName();
329 testDeleteNonExistentSync(); 339 testDeleteNonExistentSync();
330 testDeleteTooLongNameSync(); 340 testDeleteTooLongNameSync();
331 testExistsCreateDelete(); 341 testExistsCreateDelete();
332 testExistsCreateDeleteSync(); 342 testExistsCreateDeleteSync();
333 testCreateTemp(); 343 testCreateTemp();
334 testCreateDeleteTemp(); 344 testCreateDeleteTemp();
335 testCurrent(); 345 testCurrent();
346 testFromPath();
336 } 347 }
337 } 348 }
338 349
339 350
340 class NestedTempDirectoryTest { 351 class NestedTempDirectoryTest {
341 List<Directory> createdDirectories; 352 List<Directory> createdDirectories;
342 Directory current; 353 Directory current;
343 354
344 NestedTempDirectoryTest.run() 355 NestedTempDirectoryTest.run()
345 : createdDirectories = new List<Directory>() { 356 : createdDirectories = new List<Directory>() {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 438 }
428 439
429 440
430 main() { 441 main() {
431 DirectoryTest.testMain(); 442 DirectoryTest.testMain();
432 NestedTempDirectoryTest.testMain(); 443 NestedTempDirectoryTest.testMain();
433 testCreateTempErrorSync(); 444 testCreateTempErrorSync();
434 testCreateTempError(); 445 testCreateTempError();
435 testRename(); 446 testRename();
436 } 447 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698