1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-03-29 00:11:06 +00:00
Ingvar Stepanyan d7650863ab Fix or suppress {primitive}::new warnings in tests
Constructing boxed primitives was deprecated in .

Some tests have been still using these methods, so this PR either updates them to use newly added {primitive}::from implementations or adds `#[allow(deprecated)]` where necessary.
2019-04-17 18:25:45 +01:00

26 lines
604 B
Rust

use js_sys::*;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
#[allow(deprecated)]
#[wasm_bindgen_test]
fn new_undefined() {
assert_eq!(Boolean::new(&JsValue::undefined()).value_of(), false);
}
#[allow(deprecated)]
#[wasm_bindgen_test]
fn new_truely() {
assert_eq!(Boolean::new(&JsValue::from("foo")).value_of(), true);
}
#[allow(deprecated)]
#[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>());
let _: &Object = b.as_ref();
}