Skip to content

Commit 5b66045

Browse files
afdwalexcrichton
authored andcommitted
Add a test
1 parent ebab7d9 commit 5b66045

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

crates/webidl-tests/simple.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ global.Unforgeable = class Unforgeable {
8787
}
8888
};
8989

90+
global.GlobalMethod = class GlobalMethod {
91+
constructor() {
92+
this.m = () => 123;
93+
}
94+
};
95+
9096
global.PartialInterface = class PartialInterface {
9197
get un() {
9298
return 1;

crates/webidl-tests/simple.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ fn optional_method() {
6262
assert!(f.opt(None) == None);
6363
}
6464

65+
#[wasm_bindgen_test]
66+
fn global_method() {
67+
let f = GlobalMethod::new().unwrap();
68+
assert!(f.m() == 123);
69+
}
70+
6571
#[wasm_bindgen_test]
6672
fn unforgeable_is_structural() {
6773
let f = Unforgeable::new().unwrap();

crates/webidl-tests/simple.webidl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ interface OptionalMethod {
3535
octet? opt(short? a);
3636
};
3737

38+
[Global=GlobalMethod, Constructor()]
39+
interface GlobalMethod {
40+
octet m();
41+
};
42+
3843
[Constructor()]
3944
interface Unforgeable {
4045
[Unforgeable] readonly attribute short uno;

0 commit comments

Comments
 (0)