mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-05-28 21:21:21 +00:00
parent
5df2347a7a
commit
bfff8661c1
@ -1203,6 +1203,7 @@ extern {
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[derive(Clone, Debug)]
|
||||
#[wasm_bindgen(extends = Object)]
|
||||
pub type Math;
|
||||
|
||||
/// The Math.abs() function returns the absolute value of a number, that is
|
||||
|
@ -1,9 +1,22 @@
|
||||
use std::f64::consts::PI;
|
||||
use std::f64::{NEG_INFINITY, NAN};
|
||||
|
||||
use wasm_bindgen::{JsCast, prelude::*};
|
||||
use wasm_bindgen_test::*;
|
||||
use js_sys::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn math_extends() {
|
||||
#[wasm_bindgen]
|
||||
extern {
|
||||
#[wasm_bindgen(js_name = Math)]
|
||||
static math: Math;
|
||||
}
|
||||
|
||||
assert!(math.is_instance_of::<Object>());
|
||||
let _: &Object = math.as_ref();
|
||||
}
|
||||
|
||||
macro_rules! assert_eq {
|
||||
($a:expr, $b:expr) => ({
|
||||
let (a, b) = (&$a, &$b);
|
||||
|
Loading…
x
Reference in New Issue
Block a user