2017-12-21 00:24:18 +03:00
|
|
|
extern crate test_support;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn works() {
|
|
|
|
test_support::project()
|
|
|
|
.debug(false)
|
|
|
|
.file("src/lib.rs", r#"
|
|
|
|
#![feature(proc_macro)]
|
|
|
|
|
|
|
|
extern crate wasm_bindgen;
|
|
|
|
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
|
|
|
wasm_bindgen! {
|
|
|
|
pub struct A {}
|
|
|
|
|
|
|
|
impl A {
|
|
|
|
pub fn new() -> A {
|
|
|
|
A {}
|
|
|
|
}
|
|
|
|
}
|
2018-02-07 02:04:46 +03:00
|
|
|
pub fn clone(a: &JsValue) -> JsValue {
|
2017-12-21 00:24:18 +03:00
|
|
|
drop(a.clone());
|
|
|
|
a.clone()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"#)
|
|
|
|
.file("test.ts", r#"
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
"#)
|
|
|
|
.test();
|
|
|
|
}
|