43 lines
1013 B
Rust
Raw Normal View History

#![allow(non_snake_case)]
use project;
#[test]
fn has_instance() {
project()
.file(
"src/lib.rs",
r#"
#![feature(proc_macro, wasm_custom_section)]
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
use wasm_bindgen::js;
#[wasm_bindgen]
pub fn symbol_has_instance() -> js::Symbol {
js::Symbol::has_instance()
}
"#,
)
.file(
2018-07-06 15:41:07 +09:00
"test.js",
r#"
import * as assert from "assert";
import * as wasm from "./out";
2018-07-06 15:41:07 +09:00
class Array1 {
static [wasm.symbol_has_instance()](instance) {
return Array.isArray(instance);
}
}
export function test() {
2018-07-03 23:06:25 +09:00
assert.equal(typeof wasm.symbol_has_instance(), "symbol");
assert.ok([] instanceof Array1);
}
"#,
)
.test()
}