| 1 |
use wasm_bindgen_test::*; |
| 2 |
|
| 3 |
pub mod same_function_different_locations_a { |
| 4 |
use wasm_bindgen::prelude::*; |
| 5 |
|
| 6 |
#[wasm_bindgen(module = "tests/wasm/duplicates_a.js")] |
| 7 |
extern "C" { |
| 8 |
pub fn foo(); |
| 9 |
pub static bar: JsValue; |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
pub mod same_function_different_locations_b { |
| 14 |
use wasm_bindgen::prelude::*; |
| 15 |
|
| 16 |
#[wasm_bindgen(module = "tests/wasm/duplicates_a.js")] |
| 17 |
extern "C" { |
| 18 |
pub fn foo(); |
| 19 |
pub static bar: JsValue; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
#[wasm_bindgen_test] |
| 24 |
fn same_function_different_locations() { |
| 25 |
same_function_different_locations_a::foo(); |
| 26 |
same_function_different_locations_b::foo(); |
| 27 |
assert_eq!(*same_function_different_locations_a::bar, 3); |
| 28 |
assert_eq!(*same_function_different_locations_a::bar, 3); |
| 29 |
} |
| 30 |
|
| 31 |
pub mod same_function_different_modules_a { |
| 32 |
use wasm_bindgen::prelude::*; |
| 33 |
|
| 34 |
#[wasm_bindgen(module = "tests/wasm/duplicates_b.js")] |
| 35 |
extern "C" { |
| 36 |
pub fn foo() -> bool; |
| 37 |
pub static bar: JsValue; |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
pub mod same_function_different_modules_b { |
| 42 |
use wasm_bindgen::prelude::*; |
| 43 |
|
| 44 |
#[wasm_bindgen(module = "tests/wasm/duplicates_c.js")] |
| 45 |
extern "C" { |
| 46 |
pub fn foo() -> bool; |
| 47 |
pub static bar: JsValue; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
#[wasm_bindgen_test] |
| 52 |
fn same_function_different_modules() { |
| 53 |
assert!(same_function_different_modules_a::foo()); |
| 54 |
assert!(!same_function_different_modules_b::foo()); |
| 55 |
assert_eq!(*same_function_different_modules_a::bar, 4); |
| 56 |
assert_eq!(*same_function_different_modules_b::bar, 5); |
| 57 |
} |