mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 20:41:24 +00:00
try to fix global / modulaized import ns conflict (#2057)
* use global import map for rename * fix same ns import * cargo fmt * add basic test * move generate_identifier, add comments, add tests * remove leading &mut * remove unnecessary bail * use import_name for global and some refine * Add back in error handling, clean up instruction iteration * Remove unnecessary patch statements Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This commit is contained in:
@ -135,6 +135,34 @@ fn works_on_empty_project() {
|
||||
cmd.assert().success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn namespace_global_and_noglobal_works() {
|
||||
let (mut cmd, _out_dir) = Project::new("namespace_global_and_noglobal_works")
|
||||
.file(
|
||||
"src/lib.rs",
|
||||
r#"
|
||||
use wasm_bindgen::prelude::*;
|
||||
#[wasm_bindgen(module = "fs")]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_namespace = window)]
|
||||
fn t1();
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_namespace = window)]
|
||||
fn t2();
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn test() {
|
||||
t1();
|
||||
t2();
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.wasm_bindgen("");
|
||||
cmd.assert().success();
|
||||
}
|
||||
|
||||
mod npm;
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user