Skip to content

Commit

Permalink
Remove prefixes entirely.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Dec 3, 2024
1 parent 5159117 commit feaeb81
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions tests/windows-open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,41 +137,39 @@ fn windows_open_special() {
"COM8", "COM9", "COM¹", "COM²", "COM³", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5",
"LPT6", "LPT7", "LPT8", "LPT9", "LPT¹", "LPT²", "LPT³",
] {
for prefix in &["", ".", " .", ".\\", ".\\.", ". \\.", ".\\ ."] {
for suffix in &[
"",
" ",
".",
". ",
".ext",
".ext.",
".ext. ",
".ext ",
".ext.more",
".ext.more.",
".ext.more ",
".ext.more. ",
".ext.more .",
] {
let name = format!("{}{}{}", prefix, device, suffix);
eprintln!("testing '{}'", name);

match tmpdir.open(&name).unwrap_err().kind() {
std::io::ErrorKind::NotFound | std::io::ErrorKind::PermissionDenied => {}
kind => panic!("unexpected error: {:?}", kind),
}

let mut options = cap_std::fs::OpenOptions::new();
options.write(true);
match tmpdir.open_with(&name, &options).unwrap_err().kind() {
std::io::ErrorKind::NotFound | std::io::ErrorKind::PermissionDenied => {}
kind => panic!("unexpected error: {:?}", kind),
}

match tmpdir.create(&name).unwrap_err().kind() {
std::io::ErrorKind::NotFound | std::io::ErrorKind::PermissionDenied => {}
kind => panic!("unexpected error: {:?}", kind),
}
for suffix in &[
"",
" ",
".",
". ",
".ext",
".ext.",
".ext. ",
".ext ",
".ext.more",
".ext.more.",
".ext.more ",
".ext.more. ",
".ext.more .",
] {
let name = format!("{}{}{}", device, suffix);
eprintln!("testing '{}'", name);

match tmpdir.open(&name).unwrap_err().kind() {
std::io::ErrorKind::NotFound | std::io::ErrorKind::PermissionDenied => {}
kind => panic!("unexpected error: {:?}", kind),
}

let mut options = cap_std::fs::OpenOptions::new();
options.write(true);
match tmpdir.open_with(&name, &options).unwrap_err().kind() {
std::io::ErrorKind::NotFound | std::io::ErrorKind::PermissionDenied => {}
kind => panic!("unexpected error: {:?}", kind),
}

match tmpdir.create(&name).unwrap_err().kind() {
std::io::ErrorKind::NotFound | std::io::ErrorKind::PermissionDenied => {}
kind => panic!("unexpected error: {:?}", kind),
}
}
}
Expand Down

0 comments on commit feaeb81

Please sign in to comment.