69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
read $fd 1
read $fd 1
} -cleanup {
close $fd
unset fd
} -result ""
tcltest::test xvfs-basic-open-write "Xvfs Open For Writing Test" -setup {
tcltest::test xvfs-basic-open-neg "Xvfs Open Non-Existant File Test" -body {
unset -nocomplain fd
} -body {
set fd [open $rootDir/new-file w]
close $fd
set fd [open $rootDir/does-not-exist]
} -cleanup {
if {[info exists fd]} {
close $fd
unset fd
}
} -returnCodes error -result "no such file or directory"
tcltest::test xvfs-basic-open-write "Xvfs Open For Writing Test" -body {
unset -nocomplain fd
set fd [open $rootDir/new-file w]
} -cleanup {
if {[info exists fd]} {
close $fd
unset fd
}
catch {
file delete $rootDir/new-file
}
} -match glob -returnCodes error -result "*read*only file*system*"
tcltest::test xvfs-basic-open-directory "Xvfs Open Directory Test" -body {
unset -nocomplain fd
set fd [open $rootDir/lib]
set fd
} -cleanup {
if {[info exists fd]} {
close $fd
unset fd
}
} -match glob -returnCodes error -result "*illegal operation on a directory"
tcltest::test xvfs-basic-two-files "Xvfs Multiple Open Files Test" -setup {
set fd1 [open $testFile]
set fd2 [open $testFile]
} -body {
set data1 [read $fd1]
close $fd1
set data2 [read $fd2]
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
+
+
+
+
+
+
|
tcltest::test xvfs-stat-basic-file "Xvfs stat Basic File Test" -body {
file stat $testFile fileInfo
set fileInfo(type)
} -cleanup {
unset -nocomplain fileInfo
} -result file
tcltest::test xvfs-stat-basic-file-neg "Xvfs stat Basic File Negative Test" -body {
file stat $rootDir/does-not-exist fileInfo
} -cleanup {
unset -nocomplain fileInfo
} -match glob -returnCodes error -result "*no such file or directory"
tcltest::test xvfs-stat-basic-dir "Xvfs stat Basic Directory Test" -body {
file stat $rootDir/lib fileInfo
set fileInfo(type)
} -cleanup {
unset -nocomplain fileInfo
} -result directory
|