Test ErrorKind::AlreadyExists for files

This commit is contained in:
Gleb Kozyrev 2016-06-14 19:45:42 +03:00
parent 5db9424de3
commit 1db97575cc

View File

@ -1770,6 +1770,15 @@ fn file_test_directoryinfo_readdir() {
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]
fn mkdir_path_already_exists_error() {
let tmpdir = tmpdir();