mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-01 14:54:25 +03:00
32 lines
668 B
Rust
32 lines
668 B
Rust
extern crate test_support;
|
|
|
|
#[test]
|
|
fn simple() {
|
|
test_support::project()
|
|
.file("src/lib.rs", r#"
|
|
#![feature(proc_macro)]
|
|
|
|
extern crate wasm_bindgen;
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
wasm_bindgen! {
|
|
extern struct Math {
|
|
fn random() -> f64;
|
|
}
|
|
|
|
pub fn get_random() -> f64 {
|
|
Math::random()
|
|
}
|
|
}
|
|
"#)
|
|
.file("test.ts", r#"
|
|
import * as wasm from "./out";
|
|
|
|
export function test() {
|
|
wasm.get_random();
|
|
}
|
|
"#)
|
|
.test();
|
|
}
|