2018-09-26 18:26:00 +03:00
|
|
|
use js_sys::*;
|
|
|
|
use wasm_bindgen::JsCast;
|
2018-07-20 21:47:49 +03:00
|
|
|
use wasm_bindgen::JsValue;
|
|
|
|
use wasm_bindgen_test::*;
|
|
|
|
|
|
|
|
#[wasm_bindgen_test]
|
|
|
|
fn new_undefined() {
|
2018-07-26 00:33:44 +03:00
|
|
|
assert_eq!(Boolean::new(&JsValue::undefined()).value_of(), false);
|
2018-07-20 21:47:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen_test]
|
|
|
|
fn new_truely() {
|
2018-07-26 00:33:44 +03:00
|
|
|
assert_eq!(Boolean::new(&JsValue::from("foo")).value_of(), true);
|
2018-07-20 21:47:49 +03:00
|
|
|
}
|
2018-08-09 05:49:06 +03:00
|
|
|
|
|
|
|
#[wasm_bindgen_test]
|
|
|
|
fn boolean_inheritance() {
|
|
|
|
let b = Boolean::new(&JsValue::from(true));
|
|
|
|
assert!(b.is_instance_of::<Boolean>());
|
|
|
|
assert!(b.is_instance_of::<Object>());
|
2018-08-17 23:09:30 +03:00
|
|
|
let _: &Object = b.as_ref();
|
2018-08-09 05:49:06 +03:00
|
|
|
}
|