feat: add a histrical wit-bindgen

This commit is contained in:
2023-01-01 00:25:48 +08:00
parent 01e8f5a959
commit aa50d63aec
419 changed files with 45283 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
use std::path::Path;
mod imports {
test_helpers::codegen_spidermonkey_import!(
// TODO: should support more of the `*.wit` test suite
"strings.wit"
"simple-lists.wit"
"simple-functions.wit"
);
}
mod exports {
test_helpers::codegen_spidermonkey_export!(
// TODO: should support more of the `*.wit` test suite
"strings.wit"
"simple-lists.wit"
"simple-functions.wit"
);
}
fn verify(dir: &str, _name: &str) {
let wasm = std::fs::read(Path::new(dir).join("foo.wasm")).unwrap();
let mut validator = wasmparser::Validator::new();
validator.wasm_features(wasmparser::WasmFeatures {
bulk_memory: true,
module_linking: true,
multi_memory: true,
..wasmparser::WasmFeatures::default()
});
validator.validate_all(&wasm).expect("wasm isn't valid");
}