summaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
Diffstat (limited to 'std')
-rw-r--r--std/wasi/testdata/std_fs_rename.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/std/wasi/testdata/std_fs_rename.rs b/std/wasi/testdata/std_fs_rename.rs
new file mode 100644
index 000000000..53688eecb
--- /dev/null
+++ b/std/wasi/testdata/std_fs_rename.rs
@@ -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!");
+}