diff options
Diffstat (limited to 'vendor/js-sys/tests/wasm/SyntaxError.rs')
-rw-r--r-- | vendor/js-sys/tests/wasm/SyntaxError.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/js-sys/tests/wasm/SyntaxError.rs b/vendor/js-sys/tests/wasm/SyntaxError.rs new file mode 100644 index 000000000..b76b71ca6 --- /dev/null +++ b/vendor/js-sys/tests/wasm/SyntaxError.rs @@ -0,0 +1,17 @@ +use js_sys::*; +use wasm_bindgen::JsCast; +use wasm_bindgen::JsValue; +use wasm_bindgen_test::*; + +#[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 _: &Error = error.as_ref(); + let _: &Object = error.as_ref(); + + let base: &Error = error.as_ref(); + assert_eq!(JsValue::from(base.message()), "msg"); +} |