Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
50
third-party/vendor/wasm-bindgen/tests/non_wasm.rs
vendored
Normal file
50
third-party/vendor/wasm-bindgen/tests/non_wasm.rs
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
extern crate wasm_bindgen;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct A {
|
||||
x: u32,
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl A {
|
||||
pub fn new() -> A {
|
||||
A { x: 3 }
|
||||
}
|
||||
|
||||
pub fn foo(&self) {
|
||||
assert_eq!(self.x, 3);
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn foo(x: bool) {
|
||||
A::new().foo();
|
||||
|
||||
if x {
|
||||
bar("test");
|
||||
baz(JsValue::from(3));
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
fn some_import();
|
||||
static A: JsValue;
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn bar(_: &str) -> JsValue {
|
||||
some_import();
|
||||
A.clone()
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn baz(_: JsValue) {}
|
||||
|
||||
#[test]
|
||||
fn test_foo() {
|
||||
foo(false);
|
||||
A::new().foo();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue