mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-24 06:33:33 +03:00
Add tests for internal imports now working
These compiler bugs have now been fixed on nightly, so we just need to wait for the bug fixes to ride the trains to be available to everyone! Closes #201
This commit is contained in:
parent
e3e5c0f57d
commit
b868185637
@ -101,3 +101,6 @@ exports.assert_dead_import_not_generated = function() {
|
|||||||
const bindings = fs.readFileSync(filename);
|
const bindings = fs.readFileSync(filename);
|
||||||
assert.ok(!bindings.includes("unused_import"));
|
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() {
|
fn dead_imports_not_generated() {
|
||||||
assert_dead_import_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