1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-07-26 01:21:55 +00:00
Files
.cargo
ci
crates
anyref-xform
backend
cli
cli-support
futures
js-sys
src
tests
wasm
Array.rs
ArrayBuffer.rs
ArrayIterator.rs
Boolean.rs
DataView.rs
Date.rs
Error.rs
EvalError.rs
Function.js
Function.rs
Generator.js
Generator.rs
Intl.rs
Iterator.js
Iterator.rs
JSON.rs
JsString.js
JsString.rs
Map.rs
MapIterator.rs
Math.rs
Number.rs
Object.js
Object.rs
Promise.rs
Proxy.js
Proxy.rs
RangeError.rs
ReferenceError.rs
Reflect.js
Reflect.rs
RegExp.rs
Set.rs
SetIterator.rs
Symbol.js
Symbol.rs
SyntaxError.rs
TypeError.rs
TypedArray.rs
UriError.rs
WeakMap.rs
WeakSet.rs
WebAssembly.js
WebAssembly.rs
global_fns.rs
main.rs
headless.js
headless.rs
CHANGELOG.md
Cargo.toml
README.md
macro
macro-support
shared
test
test-macro
threads-xform
typescript
wasm-interpreter
web-sys
webidl
webidl-tests
examples
guide
releases
src
tests
.gitattributes
.gitignore
CHANGELOG.md
CONTRIBUTING.md
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md
azure-pipelines.yml
build.rs
package.json
publish.rs
wasm-bindgen/crates/js-sys/tests/wasm/Boolean.rs
Alex Crichton 7ecf4aae87 cargo +nightly fmt --all
Rustfmt all the things!
2018-09-26 08:26:00 -07:00

23 lines
541 B
Rust

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