mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-24 06:33:33 +03:00
Merge pull request #941 from alexcrichton/fix-201
Add tests for internal imports now working
This commit is contained in:
commit
a40b27da60
@ -101,3 +101,6 @@ exports.assert_dead_import_not_generated = function() {
|
||||
const bindings = fs.readFileSync(filename);
|
||||
assert.ok(!bindings.includes("unused_import"));
|
||||
};
|
||||
|
||||
exports.import_inside_function_works = function() {};
|
||||
exports.import_inside_private_module = function() {};
|
||||
|
@ -175,3 +175,31 @@ fn rename_static_with_string() {
|
||||
fn dead_imports_not_generated() {
|
||||
assert_dead_import_not_generated();
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
#[cfg(feature = "nightly")]
|
||||
fn import_inside_function_works() {
|
||||
#[wasm_bindgen(module = "tests/wasm/imports.js")]
|
||||
extern {
|
||||
fn import_inside_function_works();
|
||||
}
|
||||
import_inside_function_works();
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
#[cfg(feature = "nightly")]
|
||||
fn private_module_imports_work() {
|
||||
private::foo();
|
||||
}
|
||||
|
||||
mod private {
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
pub fn foo() {
|
||||
#[wasm_bindgen(module = "tests/wasm/imports.js")]
|
||||
extern {
|
||||
fn import_inside_private_module();
|
||||
}
|
||||
import_inside_private_module();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user