Fix the anyref xform working on empty modules (#1861)

If there's no need for a transformation then there's no need to inject
anything, so make sure that wasm-bindgen with anyref passes enabled
works on non-wasm-bindgen blobs as well.

Closes bytecodealliance/cargo-wasi#16
This commit is contained in:
Alex Crichton
2019-11-18 10:12:41 -06:00
committed by GitHub
parent a8882dc3a6
commit aca49e1a6e
2 changed files with 112 additions and 46 deletions

View File

@ -197,3 +197,39 @@ fn bin_crate_works() {
.success()
.stdout("hello, world\n");
}
#[test]
fn empty_interface_types() {
let (mut cmd, _out_dir) = Project::new("empty_interface_types")
.file(
"src/lib.rs",
r#"
#[no_mangle]
pub extern fn foo() {}
"#
)
.file(
"Cargo.toml",
&format!(
"
[package]
name = \"empty_interface_types\"
authors = []
version = \"1.0.0\"
edition = '2018'
[dependencies]
wasm-bindgen = {{ path = '{}' }}
[lib]
crate-type = ['cdylib']
[workspace]
",
repo_root().display(),
),
)
.wasm_bindgen("");
cmd.env("WASM_INTERFACE_TYPES", "1");
cmd.assert().success();
}