From cc2dda6754dee6f809480f0c794ccb67d59139a1 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Thu, 2 Jul 2020 21:15:02 +0800 Subject: [PATCH] test(std/wasi): add create directory and file tests (#6603) --- std/wasi/testdata/std_fs_create_dir.rs | 6 ++++++ std/wasi/testdata/std_fs_file_create.rs | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 std/wasi/testdata/std_fs_create_dir.rs create mode 100644 std/wasi/testdata/std_fs_file_create.rs diff --git a/std/wasi/testdata/std_fs_create_dir.rs b/std/wasi/testdata/std_fs_create_dir.rs new file mode 100644 index 0000000000..3ea41fd2fd --- /dev/null +++ b/std/wasi/testdata/std_fs_create_dir.rs @@ -0,0 +1,6 @@ +// { "preopens": { "/scratch": "scratch" } } + +fn main() { + assert!(std::fs::create_dir("/scratch/directory").is_ok()); + assert!(std::fs::metadata("/scratch/directory").unwrap().is_dir()); +} diff --git a/std/wasi/testdata/std_fs_file_create.rs b/std/wasi/testdata/std_fs_file_create.rs new file mode 100644 index 0000000000..eec1f8350e --- /dev/null +++ b/std/wasi/testdata/std_fs_file_create.rs @@ -0,0 +1,6 @@ +// { "preopens": { "/scratch": "scratch" } } + +fn main() { + assert!(std::fs::File::create("/scratch/file").is_ok()); + assert!(std::fs::metadata("/scratch/file").unwrap().is_file()); +}