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