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