From 5b66045aff7875a497c9c61ee1686c8b5b74ac8a Mon Sep 17 00:00:00 2001 From: Anton Danilkin Date: Sun, 5 Aug 2018 18:05:20 +0300 Subject: [PATCH] Add a test --- crates/webidl-tests/simple.js | 6 ++++++ crates/webidl-tests/simple.rs | 6 ++++++ crates/webidl-tests/simple.webidl | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/crates/webidl-tests/simple.js b/crates/webidl-tests/simple.js index 50f0b525..2f6b3876 100644 --- a/crates/webidl-tests/simple.js +++ b/crates/webidl-tests/simple.js @@ -87,6 +87,12 @@ global.Unforgeable = class Unforgeable { } }; +global.GlobalMethod = class GlobalMethod { + constructor() { + this.m = () => 123; + } +}; + global.PartialInterface = class PartialInterface { get un() { return 1; diff --git a/crates/webidl-tests/simple.rs b/crates/webidl-tests/simple.rs index a12ce7fd..914643be 100644 --- a/crates/webidl-tests/simple.rs +++ b/crates/webidl-tests/simple.rs @@ -62,6 +62,12 @@ fn optional_method() { assert!(f.opt(None) == None); } +#[wasm_bindgen_test] +fn global_method() { + let f = GlobalMethod::new().unwrap(); + assert!(f.m() == 123); +} + #[wasm_bindgen_test] fn unforgeable_is_structural() { let f = Unforgeable::new().unwrap(); diff --git a/crates/webidl-tests/simple.webidl b/crates/webidl-tests/simple.webidl index 2ac2b87f..810aba0c 100644 --- a/crates/webidl-tests/simple.webidl +++ b/crates/webidl-tests/simple.webidl @@ -35,6 +35,11 @@ interface OptionalMethod { octet? opt(short? a); }; +[Global=GlobalMethod, Constructor()] +interface GlobalMethod { + octet m(); +}; + [Constructor()] interface Unforgeable { [Unforgeable] readonly attribute short uno;