2018-08-05 05:00:16 +03:00
|
|
|
use wasm_bindgen_test::*;
|
|
|
|
|
|
|
|
pub mod same_function_different_locations_a {
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
2018-08-06 20:55:04 +03:00
|
|
|
#[wasm_bindgen(module = "tests/wasm/duplicates_a.js")]
|
2018-09-26 18:26:00 +03:00
|
|
|
extern "C" {
|
2018-08-05 05:00:16 +03:00
|
|
|
pub fn foo();
|
2018-08-20 20:52:54 +03:00
|
|
|
pub static bar: JsValue;
|
2018-08-05 05:00:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub mod same_function_different_locations_b {
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
2018-08-06 20:55:04 +03:00
|
|
|
#[wasm_bindgen(module = "tests/wasm/duplicates_a.js")]
|
2018-09-26 18:26:00 +03:00
|
|
|
extern "C" {
|
2018-08-05 05:00:16 +03:00
|
|
|
pub fn foo();
|
2018-08-20 20:52:54 +03:00
|
|
|
pub static bar: JsValue;
|
2018-08-05 05:00:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen_test]
|
|
|
|
fn same_function_different_locations() {
|
|
|
|
same_function_different_locations_a::foo();
|
|
|
|
same_function_different_locations_b::foo();
|
2018-08-20 20:52:54 +03:00
|
|
|
assert_eq!(*same_function_different_locations_a::bar, 3);
|
|
|
|
assert_eq!(*same_function_different_locations_a::bar, 3);
|
2018-08-05 05:00:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
pub mod same_function_different_modules_a {
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
2018-08-06 20:55:04 +03:00
|
|
|
#[wasm_bindgen(module = "tests/wasm/duplicates_b.js")]
|
2018-09-26 18:26:00 +03:00
|
|
|
extern "C" {
|
2018-08-05 05:00:16 +03:00
|
|
|
pub fn foo() -> bool;
|
2018-08-20 20:52:54 +03:00
|
|
|
pub static bar: JsValue;
|
2018-08-05 05:00:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub mod same_function_different_modules_b {
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
2018-08-06 20:55:04 +03:00
|
|
|
#[wasm_bindgen(module = "tests/wasm/duplicates_c.js")]
|
2018-09-26 18:26:00 +03:00
|
|
|
extern "C" {
|
2018-08-05 05:00:16 +03:00
|
|
|
pub fn foo() -> bool;
|
2018-08-20 20:52:54 +03:00
|
|
|
pub static bar: JsValue;
|
2018-08-05 05:00:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen_test]
|
|
|
|
fn same_function_different_modules() {
|
|
|
|
assert!(same_function_different_modules_a::foo());
|
|
|
|
assert!(!same_function_different_modules_b::foo());
|
2018-08-20 20:52:54 +03:00
|
|
|
assert_eq!(*same_function_different_modules_a::bar, 4);
|
|
|
|
assert_eq!(*same_function_different_modules_b::bar, 5);
|
2018-08-05 05:00:16 +03:00
|
|
|
}
|