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,51 @@
use std::path::Path;
use std::process::Command;
mod exports {
test_helpers::codegen_py_export!(
"*.wit"
// TODO: implement async support
"!async-functions.wit"
);
}
mod imports {
test_helpers::codegen_py_import!(
"*.wit"
// TODO: implement async support
"!async-functions.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 output = Command::new("mypy")
.arg(Path::new(dir).join("bindings.py"))
.arg("--config-file")
.arg("mypy.ini")
.output()
.expect("failed to run `mypy`; do you have it installed?");
if output.status.success() {
return;
}
panic!(
"mypy failed
status: {status}
stdout ---
{stdout}
stderr ---
{stderr}",
status = output.status,
stdout = String::from_utf8_lossy(&output.stdout).replace("\n", "\n\t"),
stderr = String::from_utf8_lossy(&output.stderr).replace("\n", "\n\t"),
);
}