2018-04-10 01:32:06 +03:00
|
|
|
use super::project;
|
2017-12-21 00:24:18 +03:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn works() {
|
2018-04-10 01:32:06 +03:00
|
|
|
project()
|
2017-12-21 00:24:18 +03:00
|
|
|
.debug(false)
|
2018-06-28 08:42:34 +03:00
|
|
|
.file(
|
|
|
|
"src/lib.rs",
|
|
|
|
r#"
|
2018-04-03 12:00:41 +03:00
|
|
|
#![feature(proc_macro, wasm_custom_section, wasm_import_module)]
|
2017-12-21 00:24:18 +03:00
|
|
|
|
|
|
|
extern crate wasm_bindgen;
|
|
|
|
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
2018-02-08 03:41:33 +03:00
|
|
|
#[wasm_bindgen]
|
|
|
|
pub struct A {}
|
2017-12-21 00:24:18 +03:00
|
|
|
|
2018-02-08 03:41:33 +03:00
|
|
|
#[wasm_bindgen]
|
|
|
|
impl A {
|
|
|
|
pub fn new() -> A {
|
|
|
|
A {}
|
2017-12-21 00:24:18 +03:00
|
|
|
}
|
|
|
|
}
|
2018-02-08 03:41:33 +03:00
|
|
|
|
|
|
|
#[wasm_bindgen]
|
2018-03-06 01:25:15 +03:00
|
|
|
pub fn clone(a: &JsValue) -> JsValue {
|
2018-02-08 03:41:33 +03:00
|
|
|
drop(a.clone());
|
|
|
|
a.clone()
|
|
|
|
}
|
2018-06-28 08:42:34 +03:00
|
|
|
"#,
|
|
|
|
)
|
|
|
|
.file(
|
|
|
|
"test.ts",
|
|
|
|
r#"
|
2017-12-21 00:24:18 +03:00
|
|
|
import * as assert from "assert";
|
2018-01-30 08:20:38 +03:00
|
|
|
import * as wasm from "./out";
|
2017-12-21 00:24:18 +03:00
|
|
|
|
2018-01-30 08:20:38 +03:00
|
|
|
export function test() {
|
|
|
|
let sym = (Symbol as any)('a');
|
2017-12-21 00:24:18 +03:00
|
|
|
assert.strictEqual(wasm.clone(sym), sym);
|
|
|
|
let a = wasm.A.new();
|
|
|
|
a.free();
|
|
|
|
}
|
2018-06-28 08:42:34 +03:00
|
|
|
"#,
|
|
|
|
)
|
2017-12-21 00:24:18 +03:00
|
|
|
.test();
|
|
|
|
}
|