Lines Matching defs:asin

1 use js_sys::*;
2 use wasm_bindgen::prelude::*;
3 use wasm_bindgen_test::*;
4
5 #[wasm_bindgen(module = "tests/wasm/Proxy.js")]
6 extern "C" {
7 fn proxy_target() -> JsValue;
8 fn proxy_handler() -> Object;
9
10 type Custom;
11 #[wasm_bindgen(method, getter, structural, catch)]
12 fn a(this: &Custom) -> Result<u32, JsValue>;
13 #[wasm_bindgen(method, getter, structural, catch)]
14 fn b(this: &Custom) -> Result<u32, JsValue>;
15
16 type RevocableResult;
17 #[wasm_bindgen(method, getter, structural)]
18 fn proxy(this: &RevocableResult) -> JsValue;
19 #[wasm_bindgen(method, getter, structural)]
20 fn revoke(this: &RevocableResult) -> Function;
21 }
22
23 #[wasm_bindgen_test]
24 fn new() { in abs()
25 let proxy = Proxy::new(&proxy_target(), &proxy_handler()); in abs()
26 let proxy = Custom::from(JsValue::from(proxy)); in abs()
27 assert_eq!(proxy.a().unwrap(), 100); in abs()
28 assert_eq!(proxy.b().unwrap(), 37); in abs()
29 } in abs()
30
31 #[wasm_bindgen_test] in acos()
32 fn revocable() { in acos()
33 let result = Proxy::revocable(&proxy_target(), &proxy_handler()); in acos()
34 let result = RevocableResult::from(JsValue::from(result)); in acos()
35 let proxy = result.proxy(); in acos()
36 let revoke = result.revoke(); in acos()
37 in acos()
38 let obj = Custom::from(proxy); in acos()
39 assert_eq!(obj.a().unwrap(), 100); in acos()
40 assert_eq!(obj.b().unwrap(), 37); in acos()
41 revoke.apply(&JsValue::undefined(), &Array::new()).unwrap(); in acos()
42 assert!(obj.a().is_err()); in acos()
43 assert!(obj.b().is_err()); in acos()
44 assert!(JsValue::from(obj).is_object()); in acos()
45 } in acos()