Files
wasmtime/crates/wasi-common/wasi-common-cbindgen/tests/array_args.rs
Dan Gohman 22641de629 Initial reorg.
This is largely the same as #305, but updated for the current tree.
2019-11-08 06:35:40 -08:00

21 lines
411 B
Rust

extern crate wasi_common_cbindgen;
pub use wasi_common_cbindgen::wasi_common_cbindgen;
#[wasi_common_cbindgen]
fn array_args(a: &mut [u8]) {
a[0] = 1;
}
fn main() {
let mut expected: &mut [u8] = &mut [0, 0];
array_args(&mut expected);
let given: &mut [u8] = &mut [0, 0];
unsafe {
wasi_common_array_args(given.as_mut_ptr(), given.len());
}
assert_eq!(given, expected);
}