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

Side by Side Diff: tests/standalone/src/FileTest.dart

Issue 9429054: Fix file test that was too specific. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 // Dart test program for testing file I/O. 5 // Dart test program for testing file I/O.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 8
9 class MyListOfOneElement implements List { 9 class MyListOfOneElement implements List {
10 int _value; 10 int _value;
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 file.errorHandler = (s) { 464 file.errorHandler = (s) {
465 file.errorHandler = (s) => Expect.fail("no error expected"); 465 file.errorHandler = (s) => Expect.fail("no error expected");
466 file.create(); 466 file.create();
467 file.createHandler = () { 467 file.createHandler = () {
468 file.directory(); 468 file.directory();
469 file.directoryHandler = (Directory d) { 469 file.directoryHandler = (Directory d) {
470 d.exists(); 470 d.exists();
471 d.errorHandler = (s) => Expect.fail("no error expected"); 471 d.errorHandler = (s) => Expect.fail("no error expected");
472 d.existsHandler = (exists) { 472 d.existsHandler = (exists) {
473 Expect.isTrue(exists); 473 Expect.isTrue(exists);
474 Expect.equals(tempDir, d.path); 474 Expect.isTrue(d.path.endsWith(tempDir));
475 file.delete(); 475 file.delete();
476 file.deleteHandler = () { 476 file.deleteHandler = () {
477 var file_dir = new File("."); 477 var file_dir = new File(".");
478 file_dir.directory(); 478 file_dir.directory();
479 file_dir.directoryHandler = (d) { 479 file_dir.directoryHandler = (d) {
480 Expect.fail("non-existing file"); 480 Expect.fail("non-existing file");
481 }; 481 };
482 file_dir.errorHandler = (s) { 482 file_dir.errorHandler = (s) {
483 var file_dir = new File(tempDir); 483 var file_dir = new File(tempDir);
484 file_dir.directory(); 484 file_dir.directory();
(...skipping 13 matching lines...) Expand all
498 498
499 static void testDirectorySync() { 499 static void testDirectorySync() {
500 var tempDir = tempDirectory.path; 500 var tempDir = tempDirectory.path;
501 var file = new File("${tempDir}/file"); 501 var file = new File("${tempDir}/file");
502 // Non-existing file should throw exception. 502 // Non-existing file should throw exception.
503 Expect.throws(file.directorySync, (e) { return e is FileIOException; }); 503 Expect.throws(file.directorySync, (e) { return e is FileIOException; });
504 file.createSync(); 504 file.createSync();
505 // Check that the path of the returned directory is the temp directory. 505 // Check that the path of the returned directory is the temp directory.
506 Directory d = file.directorySync(); 506 Directory d = file.directorySync();
507 Expect.isTrue(d.existsSync()); 507 Expect.isTrue(d.existsSync());
508 Expect.equals(tempDir, d.path); 508 Expect.isTrue(d.path.endsWith(tempDir));
509 file.deleteSync(); 509 file.deleteSync();
510 // Directories should throw exception. 510 // Directories should throw exception.
511 var file_dir = new File("."); 511 var file_dir = new File(".");
512 Expect.throws(file_dir.directorySync, (e) { return e is FileIOException; }); 512 Expect.throws(file_dir.directorySync, (e) { return e is FileIOException; });
513 file_dir = new File(tempDir); 513 file_dir = new File(tempDir);
514 Expect.throws(file_dir.directorySync, (e) { return e is FileIOException; }); 514 Expect.throws(file_dir.directorySync, (e) { return e is FileIOException; });
515 } 515 }
516 516
517 // Test for file length functionality. 517 // Test for file length functionality.
518 static void testLength() { 518 static void testLength() {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 testWriteVariousLists(); 966 testWriteVariousLists();
967 testDirectory(); 967 testDirectory();
968 testDirectorySync(); 968 testDirectorySync();
969 }); 969 });
970 } 970 }
971 } 971 }
972 972
973 main() { 973 main() {
974 FileTest.testMain(); 974 FileTest.testMain();
975 } 975 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698