mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 12:31:22 +00:00
Js sys once over (#550)
* js-sys: Return `f64` instead of `Number` * js-sys: remove trailing whitespace * js-sys: Ensure that all imported types derive Clone and Debug * js-sys: Imported functions should always take JS object arguments by-ref
This commit is contained in:
committed by
Alex Crichton
parent
93933f033f
commit
61fc8d2567
@ -17,16 +17,16 @@ extern {
|
||||
#[wasm_bindgen_test]
|
||||
fn apply() {
|
||||
let args = Array::new();
|
||||
args.push(1.into());
|
||||
args.push(2.into());
|
||||
args.push(3.into());
|
||||
args.push(&1.into());
|
||||
args.push(&2.into());
|
||||
args.push(&3.into());
|
||||
assert_eq!(MAX.apply(&JsValue::undefined(), &args).unwrap(), 3);
|
||||
|
||||
let arr = JsValue::from(Array::new());
|
||||
let args = Array::new();
|
||||
args.push(1.into());
|
||||
args.push(&1.into());
|
||||
ARRAY_PROTOTYPE.push().apply(&arr, &args).unwrap();
|
||||
assert_eq!(Array::from(arr).length(), 1);
|
||||
assert_eq!(Array::from(&arr).length(), 1);
|
||||
}
|
||||
|
||||
#[wasm_bindgen(module = "tests/wasm/Function.js", version = "*")]
|
||||
|
Reference in New Issue
Block a user