delete temporary tests
This commit is contained in:
@@ -334,55 +334,4 @@ mod test {
|
||||
FileType::RegularFile
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn std_rename_dir_to_existing_file() {
|
||||
let tempdir = tempfile::Builder::new()
|
||||
.prefix("cap-std-sync")
|
||||
.tempdir()
|
||||
.expect("create temporary dir");
|
||||
let target_path = tempdir.path().join("target");
|
||||
let source_path = tempdir.path().join("source");
|
||||
|
||||
let file = std::fs::File::create(&target_path).expect("create target file");
|
||||
drop(file);
|
||||
std::fs::create_dir(&source_path).expect("create source dir");
|
||||
|
||||
std::fs::rename(&source_path, &target_path)
|
||||
.expect_err("it should be impossible to rename a directory to an existing file");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rename_dir_to_existing_file() {
|
||||
let tempdir = tempfile::Builder::new()
|
||||
.prefix("cap-std-sync")
|
||||
.tempdir()
|
||||
.expect("create temporary dir");
|
||||
|
||||
let preopen_dir = unsafe { cap_std::fs::Dir::open_ambient_dir(tempdir.path()) }
|
||||
.expect("open ambient temporary dir");
|
||||
let preopen_dir = Dir::from_cap_std(preopen_dir);
|
||||
let wasi_dir: &dyn WasiDir = &preopen_dir;
|
||||
|
||||
let file = wasi_dir
|
||||
.open_file(
|
||||
false,
|
||||
"target",
|
||||
OFlags::CREATE,
|
||||
true,
|
||||
false,
|
||||
FdFlags::empty(),
|
||||
)
|
||||
.expect("create target");
|
||||
// Close the file:
|
||||
drop(file);
|
||||
|
||||
wasi_dir
|
||||
.create_dir("source")
|
||||
.expect("create source directory");
|
||||
|
||||
wasi_dir
|
||||
.rename("source", wasi_dir, "target")
|
||||
.expect_err("it should be impossible to rename a directory to an existing file");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user