mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-04 11:21:06 +00:00
js-sys: Add extends attributes for js_sys::Number
This commit is contained in:
parent
16dbed59b2
commit
42e02f7769
@ -1385,6 +1385,7 @@ extern "C" {
|
|||||||
// Number.
|
// Number.
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Number;
|
pub type Number;
|
||||||
|
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
use std::f64::{INFINITY, NAN};
|
use std::f64::{INFINITY, NAN};
|
||||||
|
|
||||||
|
use wasm_bindgen::JsCast;
|
||||||
use wasm_bindgen::JsValue;
|
use wasm_bindgen::JsValue;
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
use js_sys::*;
|
use js_sys::*;
|
||||||
|
|
||||||
|
#[wasm_bindgen_test]
|
||||||
|
fn number_inheritance() {
|
||||||
|
let number = Number::new(&JsValue::from(10));
|
||||||
|
assert!(number.is_instance_of::<Number>());
|
||||||
|
assert!(number.is_instance_of::<Object>());
|
||||||
|
}
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn is_finite() {
|
fn is_finite() {
|
||||||
assert!(Number::is_finite(&42.into()));
|
assert!(Number::is_finite(&42.into()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user