wasm-bindgen/crates/js-sys/tests/wasm/SyntaxError.rs
2018-08-16 07:14:12 -07:00

16 lines
418 B
Rust

use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
use wasm_bindgen::JsCast;
use js_sys::*;
#[wasm_bindgen_test]
fn syntax_error() {
let error = SyntaxError::new("msg");
assert!(error.is_instance_of::<SyntaxError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "msg");
}