mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-28 07:51:07 +00:00
Fix webidl-tests fallout
This commit is contained in:
parent
f24828a16b
commit
fe31615ca1
@ -1,4 +1,8 @@
|
|||||||
global.global_no_args = () => 3;
|
const map = {
|
||||||
global.global_with_args = (a, b) => a + b;
|
global_no_args: () => 3,
|
||||||
global.global_attribute = 'x';
|
global_with_args: (a, b) => a + b,
|
||||||
|
global_attribute: 'x',
|
||||||
|
};
|
||||||
|
|
||||||
|
global.get_global = () => map;
|
||||||
|
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
use js_sys::Object;
|
use js_sys::Object;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/global.rs"));
|
include!(concat!(env!("OUT_DIR"), "/global.rs"));
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern {
|
||||||
|
fn get_global() -> Global;
|
||||||
|
}
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn works() {
|
fn works() {
|
||||||
assert_eq!(Global::global_no_args(), 3);
|
let x = get_global();
|
||||||
assert_eq!(Global::global_with_args("a", "b"), "ab");
|
assert_eq!(x.global_no_args(), 3);
|
||||||
assert_eq!(Global::global_attribute(), "x");
|
assert_eq!(x.global_with_args("a", "b"), "ab");
|
||||||
Global::set_global_attribute("y");
|
assert_eq!(x.global_attribute(), "x");
|
||||||
assert_eq!(Global::global_attribute(), "y");
|
x.set_global_attribute("y");
|
||||||
|
assert_eq!(x.global_attribute(), "y");
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,11 @@ global.Unforgeable = class Unforgeable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
global.m = () => 123;
|
global.GlobalMethod = class {
|
||||||
|
m() { return 123; }
|
||||||
|
};
|
||||||
|
|
||||||
|
global.get_global_method = () => new GlobalMethod();
|
||||||
|
|
||||||
global.Indexing = function () {
|
global.Indexing = function () {
|
||||||
return new Proxy({}, {
|
return new Proxy({}, {
|
||||||
|
@ -72,9 +72,16 @@ fn nullable_method() {
|
|||||||
assert!(f.opt(None) == None);
|
assert!(f.opt(None) == None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern {
|
||||||
|
fn get_global_method() -> GlobalMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn global_method() {
|
fn global_method() {
|
||||||
assert_eq!(GlobalMethod::m(), 123);
|
let x = get_global_method();
|
||||||
|
assert_eq!(x.m(), 123);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user