6
6
import 'dart:io' as io;
7
7
8
8
import 'package:file/local.dart' ;
9
+ import 'package:file/src/testing/internal.dart' ;
9
10
import 'package:test/test.dart' ;
10
11
11
12
import 'common_tests.dart' ;
@@ -29,89 +30,50 @@ void main() {
29
30
tmp.deleteSync (recursive: true );
30
31
});
31
32
33
+ setUpAll (() {
34
+ if (io.Platform .isWindows) {
35
+ // TODO(tvolkert): Remove once all more serious test failures are fixed
36
+ // https://github.com/google/file.dart/issues/56
37
+ ignoreOsErrorCodes = true ;
38
+ }
39
+ });
40
+
41
+ tearDownAll (() {
42
+ ignoreOsErrorCodes = false ;
43
+ });
44
+
32
45
Map <String , List <String >> skipOnPlatform = < String , List <String >> {
33
46
'windows' : < String > [
34
47
'FileSystem > currentDirectory > throwsIfHasNonExistentPathInComplexChain' ,
35
48
'FileSystem > currentDirectory > staysAtRootIfSetToParentOfRoot' ,
36
- 'FileSystem > currentDirectory > throwsIfSetToFilePathSegmentAtTail' ,
37
- 'FileSystem > currentDirectory > throwsIfSetToFilePathSegmentViaTraversal' ,
38
49
'FileSystem > currentDirectory > resolvesLinksIfEncountered' ,
39
50
'FileSystem > currentDirectory > succeedsIfSetToDirectoryLinkAtTail' ,
40
- 'FileSystem > currentDirectory > throwsIfSetToLinkLoop' ,
41
51
'FileSystem > stat > isFileForLinkToFile' ,
42
52
'FileSystem > type > isFileForLinkToFileAndFollowLinksTrue' ,
43
53
'FileSystem > type > isNotFoundForLinkWithCircularReferenceAndFollowLinksTrue' ,
44
54
'Directory > uri' ,
45
55
'Directory > exists > falseIfExistsAsLinkToFile' ,
46
56
'Directory > exists > falseIfNotFoundSegmentExistsThenIsBackedOut' ,
47
- 'Directory > create > throwsIfAlreadyExistsAsFile' ,
48
57
'Directory > create > throwsIfAlreadyExistsAsLinkToFile' ,
49
- 'Directory > create > throwsIfAlreadyExistsAsLinkToNotFoundViaTraversal' ,
50
- 'Directory > create > throwsIfAncestorDoesntExistRecursiveFalse' ,
51
- 'Directory > rename > throwsIfDestinationIsFile' ,
52
- 'Directory > rename > throwsIfDestinationParentFolderDoesntExist' ,
53
58
'Directory > rename > throwsIfDestinationIsNonEmptyDirectory' ,
54
- 'Directory > rename > throwsIfSourceIsFile' ,
55
- 'Directory > rename > throwsIfDestinationIsLinkToNotFound' ,
56
59
'Directory > rename > throwsIfDestinationIsLinkToEmptyDirectory' ,
57
- 'Directory > delete > throwsIfNonEmptyDirectoryExistsAndRecursiveFalse' ,
58
- 'Directory > delete > throwsIfPathReferencesFileAndRecursiveFalse' ,
59
60
'Directory > delete > throwsIfPathReferencesLinkToFileAndRecursiveFalse' ,
60
- 'Directory > delete > throwsIfPathReferencesLinkToNotFoundAndRecursiveFalse' ,
61
- 'Directory > resolveSymbolicLinks > throwsIfLoopInLinkChain' ,
62
- 'Directory > resolveSymbolicLinks > throwsIfPathNotFoundInTraversal' ,
63
61
'Directory > resolveSymbolicLinks > throwsIfPathNotFoundInMiddleThenBackedOut' ,
64
- 'Directory > createTemp > throwsIfDirectoryDoesntExist' ,
65
62
'Directory > createTemp > succeedsWithNestedPathPrefixThatExists' ,
66
- 'Directory > createTemp > throwsWithNestedPathPrefixThatDoesntExist' ,
67
- 'Directory > list > throwsIfDirectoryDoesntExist' ,
68
63
'Directory > list > followsLinksIfFollowLinksTrue' ,
69
64
'Directory > list > returnsLinkObjectsForRecursiveLinkIfFollowLinksTrue' ,
70
65
'File > uri' ,
71
- 'File > create > throwsIfAncestorDoesntExistRecursiveFalse' ,
72
66
'File > create > succeedsIfAlreadyExistsAsLinkToFile' ,
73
67
'File > create > succeedsIfAlreadyExistsAsLinkToNotFoundAtTail' ,
74
- 'File > create > throwsIfAlreadyExistsAsLinkToNotFoundViaTraversal' ,
75
68
'File > create > succeedsIfAlreadyExistsAsLinkToNotFoundInDifferentDirectory' ,
76
- 'File > rename > throwsIfDestinationDoesntExistViaTraversal' ,
77
- 'File > rename > throwsIfDestinationExistsAsDirectory' ,
78
69
'File > rename > succeedsIfDestinationExistsAsLinkToFile' ,
79
70
'File > rename > succeedsIfDestinationExistsAsLinkToNotFound' ,
80
- 'File > rename > throwsIfSourceExistsAsDirectory' ,
81
71
'File > rename > succeedsIfSourceExistsAsLinkToFile' ,
82
- 'File > rename > throwsIfSourceExistsAsLinkToDirectory' ,
83
- 'File > copy > throwsIfDestinationDoesntExistViaTraversal' ,
84
- 'File > copy > throwsIfDestinationExistsAsDirectory' ,
85
72
'File > copy > succeedsIfDestinationExistsAsLinkToFile' ,
86
- 'File > copy > throwsIfDestinationExistsAsLinkToDirectory' ,
87
- 'File > copy > throwsIfSourceExistsAsDirectory' ,
88
73
'File > copy > succeedsIfSourceExistsAsLinkToFile' ,
89
74
'File > copy > succeedsIfSourceIsLinkToFileInDifferentDirectory' ,
90
75
'File > copy > succeedsIfDestinationIsLinkToFileInDifferentDirectory' ,
91
- 'File > open > READ > throwsIfDoesntExistViaTraversal' ,
92
- 'File > open > READ > RandomAccessFile > throwsIfWriteByte' ,
93
- 'File > open > READ > RandomAccessFile > throwsIfWriteFrom' ,
94
- 'File > open > READ > RandomAccessFile > throwsIfWriteString' ,
95
- 'File > open > READ > RandomAccessFile > position > throwsIfSetToNegativeNumber' ,
96
- 'File > open > READ > RandomAccessFile > throwsIfTruncate' ,
97
- 'File > open > WRITE > throwsIfDoesntExistViaTraversal' ,
98
- 'File > open > WRITE > RandomAccessFile > position > throwsIfSetToNegativeNumber' ,
99
- 'File > open > APPEND > throwsIfDoesntExistViaTraversal' ,
100
- 'File > open > APPEND > RandomAccessFile > position > throwsIfSetToNegativeNumber' ,
101
- 'File > open > WRITE_ONLY > throwsIfDoesntExistViaTraversal' ,
102
- 'File > open > WRITE_ONLY > RandomAccessFile > throwsIfReadByte' ,
103
- 'File > open > WRITE_ONLY > RandomAccessFile > throwsIfRead' ,
104
- 'File > open > WRITE_ONLY > RandomAccessFile > throwsIfReadInto' ,
105
- 'File > open > WRITE_ONLY > RandomAccessFile > position > throwsIfSetToNegativeNumber' ,
106
- 'File > open > WRITE_ONLY_APPEND > throwsIfDoesntExistViaTraversal' ,
107
- 'File > open > WRITE_ONLY_APPEND > RandomAccessFile > throwsIfReadByte' ,
108
- 'File > open > WRITE_ONLY_APPEND > RandomAccessFile > throwsIfRead' ,
109
- 'File > open > WRITE_ONLY_APPEND > RandomAccessFile > throwsIfReadInto' ,
110
- 'File > open > WRITE_ONLY_APPEND > RandomAccessFile > position > throwsIfSetToNegativeNumber' ,
111
- 'File > openRead > throwsIfExistsAsDirectory' ,
112
76
'File > openRead > succeedsIfExistsAsLinkToFile' ,
113
- 'File > openWrite > throwsIfExistsAsDirectory' ,
114
- 'File > openWrite > throwsIfExistsAsLinkToDirectory' ,
115
77
'File > openWrite > succeedsIfExistsAsLinkToFile' ,
116
78
'File > openWrite > ioSink > throwsIfEncodingIsNullAndWriteObject' ,
117
79
'File > openWrite > ioSink > allowsChangingEncoding' ,
@@ -127,48 +89,19 @@ void main() {
127
89
'File > openWrite > ioSink > addStream > blocksCallToWriteCharCodeWhileStreamIsActive' ,
128
90
'File > openWrite > ioSink > addStream > blocksCallToWritelnWhileStreamIsActive' ,
129
91
'File > openWrite > ioSink > addStream > blocksCallToFlushWhileStreamIsActive' ,
130
- 'File > readAsBytes > throwsIfExistsAsDirectory' ,
131
- 'File > readAsBytes > throwsIfExistsAsLinkToDirectory' ,
132
92
'File > readAsBytes > succeedsIfExistsAsLinkToFile' ,
133
- 'File > readAsString > throwsIfExistsAsDirectory' ,
134
- 'File > readAsString > throwsIfExistsAsLinkToDirectory' ,
135
93
'File > readAsString > succeedsIfExistsAsLinkToFile' ,
136
- 'File > readAsLines > throwsIfExistsAsDirectory' ,
137
- 'File > readAsLines > throwsIfExistsAsLinkToDirectory' ,
138
- 'File > writeAsBytes > throwsIfExistsAsDirectory' ,
139
- 'File > writeAsBytes > throwsIfExistsAsLinkToDirectory' ,
140
94
'File > writeAsBytes > succeedsIfExistsAsLinkToFile' ,
141
- 'File > writeAsBytes > throwsIfFileModeRead' ,
142
- 'File > writeAsString > throwsIfExistsAsDirectory' ,
143
- 'File > writeAsString > throwsIfExistsAsLinkToDirectory' ,
144
95
'File > writeAsString > succeedsIfExistsAsLinkToFile' ,
145
- 'File > writeAsString > throwsIfFileModeRead' ,
146
96
'File > stat > isFileIfExistsAsLinkToFile' ,
147
- 'File > delete > throwsIfExistsAsDirectoryAndRecursiveFalse' ,
148
97
'File > delete > succeedsIfExistsAsLinkToFileAndRecursiveFalse' ,
149
- 'File > delete > throwsIfExistsAsLinkToDirectoryAndRecursiveFalse' ,
150
98
'Link > uri > whenTargetIsDirectory' ,
151
99
'Link > uri > whenTargetIsFile' ,
152
100
'Link > uri > whenLinkDoesntExist' ,
153
101
'Link > stat > isFileIfTargetIsFile' ,
154
102
'Link > stat > isDirectoryIfTargetIsDirectory' ,
155
- 'Link > delete > throwsIfPathReferencesFileAndRecursiveFalse' ,
156
- 'Link > delete > throwsIfPathReferencesDirectoryAndRecursiveFalse' ,
157
- 'Link > create > throwsIfLinkDoesntExistViaTraversalAndRecursiveFalse' ,
158
103
'Link > create > succeedsIfLinkDoesntExistViaTraversalAndRecursiveTrue' ,
159
- 'Link > create > throwsIfAlreadyExistsAsFile' ,
160
- 'Link > create > throwsIfAlreadyExistsAsDirectory' ,
161
- 'Link > create > throwsIfAlreadyExistsWithSameTarget' ,
162
- 'Link > create > throwsIfAlreadyExistsWithDifferentTarget' ,
163
- 'Link > update > throwsIfPathReferencesFile' ,
164
- 'Link > update > throwsIfPathReferencesDirectory' ,
165
- 'Link > target > throwsIfLinkDoesntExistViaTraversal' ,
166
- 'Link > target > throwsIfPathReferencesFile' ,
167
- 'Link > target > throwsIfPathReferencesDirectory' ,
168
104
'Link > rename > returnsCovariantType' ,
169
- 'Link > rename > throwsIfSourceIsFile' ,
170
- 'Link > rename > throwsIfSourceIsDirectory' ,
171
- 'Link > rename > throwsIfDestinationDoesntExistViaTraversal' ,
172
105
'Link > rename > succeedsIfDestinationExistsAsLinkToFile' ,
173
106
'Link > rename > throwsIfDestinationExistsAsLinkToDirectory' ,
174
107
'Link > rename > succeedsIfDestinationExistsAsLinkToNotFound' ,
0 commit comments