File tree 3 files changed +46
-0
lines changed
3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ const wasm = require ( "wasm-bindgen-test.js" ) ;
2
+ const assert = require ( "assert" ) ;
3
+
4
+ exports . js_works = ( ) => {
5
+ assert . strictEqual ( wasm . valid_export ( ) , true ) ;
6
+ assert . strictEqual ( wasm . invalid_export , undefined ) ;
7
+ assert . strictEqual ( wasm . valid_attr_export ( ) , true ) ;
8
+ assert . strictEqual ( wasm . invalid_attr_export , undefined ) ;
9
+ } ;
Original file line number Diff line number Diff line change
1
+ use wasm_bindgen:: prelude:: * ;
2
+ use wasm_bindgen_test:: * ;
3
+
4
+ #[ wasm_bindgen( module = "tests/wasm/attributes.js" ) ]
5
+ extern "C" {
6
+ fn js_works ( ) ;
7
+ }
8
+
9
+ #[ wasm_bindgen_test]
10
+ fn works ( ) {
11
+ js_works ( ) ;
12
+ }
13
+
14
+ #[ wasm_bindgen]
15
+ #[ cfg( target_arch = "wasm32" ) ]
16
+ pub fn valid_export ( ) -> bool {
17
+ true
18
+ }
19
+
20
+ #[ wasm_bindgen]
21
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
22
+ pub fn invalid_export ( ) -> bool {
23
+ false
24
+ }
25
+
26
+ #[ wasm_bindgen]
27
+ #[ cfg_attr( not( target_arch = "wasm32" ) , cfg( feature = "missing-feature" ) ) ]
28
+ pub fn valid_attr_export ( ) -> bool {
29
+ true
30
+ }
31
+
32
+ #[ wasm_bindgen]
33
+ #[ cfg_attr( target_arch = "wasm32" , cfg( feature = "missing-feature" ) ) ]
34
+ pub fn invalid_attr_export ( ) -> bool {
35
+ false
36
+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ use wasm_bindgen::prelude::*;
16
16
17
17
pub mod api;
18
18
pub mod arg_names;
19
+ pub mod attributes;
19
20
pub mod bigint;
20
21
pub mod char;
21
22
pub mod classes;
You can’t perform that action at this time.
0 commit comments