-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
423c2e1
commit 694d929
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const wasm = require("wasm-bindgen-test.js"); | ||
const assert = require("assert"); | ||
|
||
exports.js_works = () => { | ||
assert.strictEqual(wasm.valid_export(), true); | ||
assert.strictEqual(wasm.invalid_export, undefined); | ||
assert.strictEqual(wasm.valid_attr_export(), true); | ||
assert.strictEqual(wasm.invalid_attr_export, undefined); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use wasm_bindgen::prelude::*; | ||
use wasm_bindgen_test::*; | ||
|
||
#[wasm_bindgen(module = "tests/wasm/attributes.js")] | ||
extern "C" { | ||
fn js_works(); | ||
} | ||
|
||
#[wasm_bindgen_test] | ||
fn works() { | ||
js_works(); | ||
} | ||
|
||
#[wasm_bindgen] | ||
#[cfg(target_arch = "wasm32")] | ||
pub fn valid_export() -> bool { | ||
true | ||
} | ||
|
||
#[wasm_bindgen] | ||
#[cfg(not(target_arch = "wasm32"))] | ||
pub fn invalid_export() -> bool { | ||
false | ||
} | ||
|
||
#[wasm_bindgen] | ||
#[cfg_attr(target_arch = "wasm32", no_mangle)] | ||
pub fn valid_attr_export() -> bool { | ||
true | ||
} | ||
|
||
#[wasm_bindgen] | ||
#[cfg_attr(not(target_arch = "wasm32"), no_mangle)] | ||
pub fn invalid_attr_export() -> bool { | ||
false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters