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,38 @@
use std::path::Path;
use std::process::Command;
mod exports {
test_helpers::codegen_js_export!(
// ...
"*.wit"
);
}
mod imports {
test_helpers::codegen_js_import!(
"*.wit"
// This uses buffers, which we don't support in imports just yet
// TODO: should support this
"!wasi-next.wit"
"!host.wit"
);
}
fn verify(dir: &str, name: &str) {
let (cmd, args) = if cfg!(windows) {
("cmd.exe", &["/c", "npx.cmd"] as &[&str])
} else {
("npx", &[] as &[&str])
};
let status = Command::new(cmd)
.args(args)
.arg("eslint")
.arg("-c")
.arg(".eslintrc.js")
.arg(Path::new(dir).join(&format!("{}.js", name)))
.status()
.unwrap();
assert!(status.success());
}