wasm-bindgen/crates/js-sys/tests/wasm/RangeError.rs
2018-08-10 13:03:44 -07:00

15 lines
392 B
Rust

use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
use wasm_bindgen::JsCast;
use js_sys::*;
#[wasm_bindgen_test]
fn range_error() {
let error = RangeError::new("out of range yo");
assert!(error.is_instance_of::<RangeError>());
assert!(error.is_instance_of::<Error>());
let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "out of range yo");
}