Skip to content

Commit

Permalink
Merge branch 'master' into migrate-wasmer-private
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt authored Nov 1, 2022
2 parents 5160cb5 + c84357d commit 51ae0b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Binary file modified tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions tests/wasi-wast/wasi/nightly_2022_10_18/fd_rights.wast
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
;; This file was generated by https://github.com/wasmerio/wasi-tests

(wasi_test "fd_rights.wasm"
(temp_dirs ".")
(assert_return (i64.const 0))
)
15 changes: 14 additions & 1 deletion tests/wasi-wast/wasi/tests/fd_rights.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
// WASI:
// tempdir: .

use std::io::{Read, Write};
use std::path::PathBuf;

fn main() {
let file = {
let mut base = PathBuf::from(".");

base.push("foo.txt");
base
};

let mut filehandle = std::fs::OpenOptions::new()
.read(false) // <- should only be writeable, not readable
.write(true)
.create(true)
.open("foo.txt")
.open(&file)
.unwrap();
filehandle.write_all(b"test");

let mut contents = String::new();
assert!(filehandle.read_to_string(&mut contents).is_err());

std::fs::remove_file(&file).unwrap();
}

0 comments on commit 51ae0b6

Please sign in to comment.