mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
test(std/wasi): add rename test (#6573)
This commit is contained in:
parent
9b749945bb
commit
971dfcf9bb
1 changed files with 11 additions and 0 deletions
11
std/wasi/testdata/std_fs_rename.rs
vendored
Normal file
11
std/wasi/testdata/std_fs_rename.rs
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
// { "preopens": { "/scratch": "scratch" } }
|
||||
|
||||
fn main() {
|
||||
let old_path = "/scratch/old_file";
|
||||
let new_path = "/scratch/new_file";
|
||||
|
||||
assert!(std::fs::write(old_path, b"Hello, world!").is_ok());
|
||||
assert!(std::fs::rename(old_path, new_path).is_ok());
|
||||
assert!(std::fs::read(old_path).is_err());
|
||||
assert_eq!(std::fs::read(new_path).unwrap(), b"Hello, world!");
|
||||
}
|
Loading…
Reference in a new issue