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)
|
2018-06-27 22:42:34 -07:00
|
|
|
.file(
|
|
|
|
"src/lib.rs",
|
|
|
|
r#"
|
2018-07-04 22:37:09 -05:00
|
|
|
#![feature(proc_macro, wasm_custom_section, wasm_import_module)]
|
2017-12-20 13:24:18 -08:00
|
|
|
|
2018-07-04 22:37:09 -05:00
|
|
|
extern crate wasm_bindgen;
|
2017-12-20 13:24:18 -08:00
|
|
|
|
2018-07-04 22:37:09 -05:00
|
|
|
use wasm_bindgen::prelude::*;
|
2017-12-20 13:24:18 -08:00
|
|
|
|
2018-07-04 22:37:09 -05:00
|
|
|
#[wasm_bindgen]
|
|
|
|
pub struct A {}
|
2017-12-20 13:24:18 -08:00
|
|
|
|
2018-07-04 22:37:09 -05: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
|
|
|
|
2018-07-04 22:37:09 -05:00
|
|
|
#[wasm_bindgen]
|
|
|
|
pub fn clone(a: &JsValue) -> JsValue {
|
|
|
|
drop(a.clone());
|
|
|
|
a.clone()
|
|
|
|
}
|
|
|
|
"#,
|
2018-06-27 22:42:34 -07:00
|
|
|
)
|
|
|
|
.file(
|
2018-07-04 22:37:09 -05:00
|
|
|
"test.js",
|
2018-06-27 22:42:34 -07:00
|
|
|
r#"
|
2018-07-04 22:37:09 -05:00
|
|
|
import * as assert from "assert";
|
|
|
|
import * as wasm from "./out";
|
2017-12-20 13:24:18 -08:00
|
|
|
|
2018-07-04 22:37:09 -05:00
|
|
|
export function test() {
|
|
|
|
let sym = Symbol('a');
|
|
|
|
assert.strictEqual(wasm.clone(sym), sym);
|
|
|
|
let a = wasm.A.new();
|
|
|
|
a.free();
|
|
|
|
}
|
|
|
|
"#,
|
2018-06-27 22:42:34 -07:00
|
|
|
)
|
2017-12-20 13:24:18 -08:00
|
|
|
.test();
|
|
|
|
}
|