Test ErrorKind::AlreadyExists for files
This commit is contained in:
parent
5db9424de3
commit
1db97575cc
1 changed files with 9 additions and 0 deletions
|
@ -1770,6 +1770,15 @@ mod tests {
|
||||||
check!(fs::remove_dir(dir));
|
check!(fs::remove_dir(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn file_create_new_already_exists_error() {
|
||||||
|
let tmpdir = tmpdir();
|
||||||
|
let file = &tmpdir.join("file_create_new_error_exists");
|
||||||
|
check!(fs::File::create(file));
|
||||||
|
let e = fs::OpenOptions::new().write(true).create_new(true).open(file).unwrap_err();
|
||||||
|
assert_eq!(e.kind(), ErrorKind::AlreadyExists);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn mkdir_path_already_exists_error() {
|
fn mkdir_path_already_exists_error() {
|
||||||
let tmpdir = tmpdir();
|
let tmpdir = tmpdir();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue