1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-02 17:01:14 -05:00
denoland-deno/std/wasi/testdata/std_fs_rename.rs
2020-06-29 23:37:05 -04:00

11 lines
367 B
Rust

// { "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!");
}