@@ -134,30 +134,43 @@ fn windows_open_special() {
134134 // Opening any of these should fail.
135135 for device in & [
136136 "CON" , "PRN" , "AUX" , "NUL" , "COM0" , "COM1" , "COM2" , "COM3" , "COM4" , "COM5" , "COM6" , "COM7" ,
137- "COM8" , "COM9" , "LPT0 " , "LPT1 " , "LPT2 " , "LPT3 " , "LPT4 " , "LPT5 " , "LPT6 " , "LPT7 " , "LPT8 " ,
138- "LPT9" ,
137+ "COM8" , "COM9" , "COM¹ " , "COM² " , "COM³ " , "LPT0 " , "LPT1 " , "LPT2 " , "LPT3 " , "LPT4 " , "LPT5 " ,
138+ "LPT6" , "LPT7" , "LPT8" , " LPT9" , "LPT¹" , "LPT²" , "LPT³ ",
139139 ] {
140- tmpdir. open ( device) . unwrap_err ( ) ;
141- tmpdir. open ( & format ! ( ".\\ {}" , device) ) . unwrap_err ( ) ;
142- tmpdir. open ( & format ! ( "{}.ext" , device) ) . unwrap_err ( ) ;
143- tmpdir. open ( & format ! ( ".\\ {}.ext" , device) ) . unwrap_err ( ) ;
144-
145- let mut options = cap_std:: fs:: OpenOptions :: new ( ) ;
146- options. write ( true ) ;
147- tmpdir. open_with ( device, & options) . unwrap_err ( ) ;
148- tmpdir
149- . open_with ( & format ! ( ".\\ {}" , device) , & options)
150- . unwrap_err ( ) ;
151- tmpdir
152- . open_with ( & format ! ( "{}.ext" , device) , & options)
153- . unwrap_err ( ) ;
154- tmpdir
155- . open_with ( & format ! ( ".\\ {}.ext" , device) , & options)
156- . unwrap_err ( ) ;
157-
158- tmpdir. create ( device) . unwrap_err ( ) ;
159- tmpdir. create ( & format ! ( ".\\ {}" , device) ) . unwrap_err ( ) ;
160- tmpdir. create ( & format ! ( "{}.ext" , device) ) . unwrap_err ( ) ;
161- tmpdir. create ( & format ! ( ".\\ {}.ext" , device) ) . unwrap_err ( ) ;
140+ for suffix in & [
141+ "" ,
142+ " " ,
143+ "." ,
144+ ". " ,
145+ ".ext" ,
146+ ".ext." ,
147+ ".ext. " ,
148+ ".ext " ,
149+ ".ext.more" ,
150+ ".ext.more." ,
151+ ".ext.more " ,
152+ ".ext.more. " ,
153+ ".ext.more ." ,
154+ ] {
155+ let name = format ! ( "{}{}" , device, suffix) ;
156+ eprintln ! ( "testing '{}'" , name) ;
157+
158+ match tmpdir. open ( & name) . unwrap_err ( ) . kind ( ) {
159+ std:: io:: ErrorKind :: NotFound | std:: io:: ErrorKind :: PermissionDenied => { }
160+ kind => panic ! ( "unexpected error: {:?}" , kind) ,
161+ }
162+
163+ let mut options = cap_std:: fs:: OpenOptions :: new ( ) ;
164+ options. write ( true ) ;
165+ match tmpdir. open_with ( & name, & options) . unwrap_err ( ) . kind ( ) {
166+ std:: io:: ErrorKind :: NotFound | std:: io:: ErrorKind :: PermissionDenied => { }
167+ kind => panic ! ( "unexpected error: {:?}" , kind) ,
168+ }
169+
170+ match tmpdir. create ( & name) . unwrap_err ( ) . kind ( ) {
171+ std:: io:: ErrorKind :: NotFound | std:: io:: ErrorKind :: PermissionDenied => { }
172+ kind => panic ! ( "unexpected error: {:?}" , kind) ,
173+ }
174+ }
162175 }
163176}
0 commit comments