Debian Codegraph @

.cargo/vendor/wasm-bindgen/tests/wasm/rethrow.rs

raw
1 use wasm_bindgen::prelude::*;
2 use wasm_bindgen_test::*;
3
4 #[wasm_bindgen(module = "tests/wasm/rethrow.js")]
5 extern "C" {
6 fn call_throw_one();
7 fn call_ok();
8 }
9
10 #[wasm_bindgen_test]
11 fn err_works() {
12 call_throw_one();
13 }
14
15 #[wasm_bindgen]
16 pub fn throw_one() -> Result<u32, JsValue> {
17 Err(1.into())
18 }
19
20 #[wasm_bindgen_test]
21 fn ok_works() {
22 call_ok();
23 }
24
25 #[wasm_bindgen]
26 pub fn nothrow() -> Result<u32, JsValue> {
27 Ok(1)
28 }