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

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

Issue 10054005: Remove check whether async has been used from File objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « runtime/bin/file_impl.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 // 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 #import("dart:isolate"); 8 #import("dart:isolate");
9 9
10 class MyListOfOneElement implements List { 10 class MyListOfOneElement implements List {
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 exceptionCaught = true; 829 exceptionCaught = true;
830 } catch (Exception ex) { 830 } catch (Exception ex) {
831 wrongExceptionCaught = true; 831 wrongExceptionCaught = true;
832 } 832 }
833 Expect.equals(true, exceptionCaught); 833 Expect.equals(true, exceptionCaught);
834 Expect.equals(true, !wrongExceptionCaught); 834 Expect.equals(true, !wrongExceptionCaught);
835 openedFile.closeSync(); 835 openedFile.closeSync();
836 file.deleteSync(); 836 file.deleteSync();
837 } 837 }
838 838
839 static void testMixedSyncAndAsync() {
840 var name = getFilename("tests/vm/data/fixed_length_file");
841 var f = new File(name);
842 f.onError = (e) => Expect.fail("No errors expected: $e");
843 f.exists((exists) {
844 try {
845 f.existsSync();
846 Expect.fail("Expected exception");
847 } catch (var e) {
848 Expect.isTrue(e is FileIOException);
849 }
850 });
851 }
852
853 static void testOpenDirectoryAsFile() { 839 static void testOpenDirectoryAsFile() {
854 var f = new File('.'); 840 var f = new File('.');
855 f.open(FileMode.READ, (r) => Expect.fail('Directory opened as file')); 841 f.open(FileMode.READ, (r) => Expect.fail('Directory opened as file'));
856 } 842 }
857 843
858 static void testOpenDirectoryAsFileSync() { 844 static void testOpenDirectoryAsFileSync() {
859 var f = new File('.'); 845 var f = new File('.');
860 try { 846 try {
861 f.openSync(); 847 f.openSync();
862 Expect.fail("Expected exception opening directory as file"); 848 Expect.fail("Expected exception opening directory as file");
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 1035
1050 // Main test entrypoint. 1036 // Main test entrypoint.
1051 static testMain() { 1037 static testMain() {
1052 testRead(); 1038 testRead();
1053 testReadSync(); 1039 testReadSync();
1054 testReadStream(); 1040 testReadStream();
1055 testLength(); 1041 testLength();
1056 testLengthSync(); 1042 testLengthSync();
1057 testPosition(); 1043 testPosition();
1058 testPositionSync(); 1044 testPositionSync();
1059 testMixedSyncAndAsync();
1060 testOpenDirectoryAsFile(); 1045 testOpenDirectoryAsFile();
1061 testOpenDirectoryAsFileSync(); 1046 testOpenDirectoryAsFileSync();
1062 testReadAsBytes(); 1047 testReadAsBytes();
1063 testReadAsBytesSync(); 1048 testReadAsBytesSync();
1064 testReadAsText(); 1049 testReadAsText();
1065 testReadAsTextSync(); 1050 testReadAsTextSync();
1066 testReadAsLines(); 1051 testReadAsLines();
1067 testReadAsLinesSync(); 1052 testReadAsLinesSync();
1068 testReadAsErrors(); 1053 testReadAsErrors();
1069 1054
(...skipping 16 matching lines...) Expand all
1086 testWriteVariousLists(); 1071 testWriteVariousLists();
1087 testDirectory(); 1072 testDirectory();
1088 testDirectorySync(); 1073 testDirectorySync();
1089 }); 1074 });
1090 } 1075 }
1091 } 1076 }
1092 1077
1093 main() { 1078 main() {
1094 FileTest.testMain(); 1079 FileTest.testMain();
1095 } 1080 }
OLDNEW
« no previous file with comments | « runtime/bin/file_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698