From 72a19e0d08250654fd72a8cc8d0786160ec290f9 Mon Sep 17 00:00:00 2001 From: a1trl9 Date: Mon, 30 Mar 2020 23:12:47 +0800 Subject: [PATCH] add basic test --- crates/cli/tests/wasm-bindgen/main.rs | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/cli/tests/wasm-bindgen/main.rs b/crates/cli/tests/wasm-bindgen/main.rs index a65b89a0d9e..a2846a064cd 100644 --- a/crates/cli/tests/wasm-bindgen/main.rs +++ b/crates/cli/tests/wasm-bindgen/main.rs @@ -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]