wasm-bindgen/crates/webidl-tests/callbacks.rs
Nick Fitzgerald 93a510ef93 webidl: All interfaces implicitly extend Object
This information is embedded within the algorithm for constructing interfaces
and their prototypes in the section for ECMAScript glue in the WebIDL spec...

This really *should* make the `wasm_bindgen_backend::ast::ImportType::extends`
member from a `Vec<Ident>` into a `Vec<syn::Path>` so that we could use
`js_sys::Object` in the extends field, but that is a huge pain because then the
`ImportedTypes` trait needs to be changed, and all of its implementers, etc...
2018-09-12 15:25:09 -07:00

39 lines
898 B
Rust

use wasm_bindgen_test::*;
use js_sys::{Function, Object};
include!(concat!(env!("OUT_DIR"), "/callbacks.rs"));
#[wasm_bindgen_test]
fn multi_op_same_name() {
let a = CallbackInterface2::new();
let b = TakeCallbackInterface::new().unwrap();
b.b(&a);
}
#[wasm_bindgen_test]
fn single_op_function() {
let a = Function::new_no_args("");
let b = TakeCallbackInterface::new().unwrap();
b.a_with_callback(&a);
}
#[wasm_bindgen_test]
fn single_op_dict() {
let a = CallbackInterface1::new();
let b = TakeCallbackInterface::new().unwrap();
b.a_with_callback_interface1(&a);
}
#[wasm_bindgen_test]
fn dict_methods() {
let mut a = CallbackInterface1::new();
a.foo(&Function::new_no_args(""));
}
#[wasm_bindgen_test]
fn dict_methods1() {
let mut a = CallbackInterface2::new();
a.foo(&Function::new_no_args(""));
a.bar(&Function::new_no_args(""));
}