Debian Codegraph @

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

raw
1 extern crate wasm_bindgen;
2 use wasm_bindgen::prelude::*;
3
4 #[test]
5 fn unwrap_throw_ok() {
6 assert_eq!(Some(42).unwrap_throw(), 42);
7 let x: Result<i32, ()> = Ok(42);
8 assert_eq!(x.unwrap_throw(), 42);
9 }
10
11 #[test]
12 #[should_panic]
13 fn unwrap_throw_none() {
14 let x: Option<i32> = None;
15 x.unwrap_throw();
16 }
17
18 #[test]
19 #[should_panic]
20 fn unwrap_throw_err() {
21 let x: Result<i32, ()> = Err(());
22 x.unwrap_throw();
23 }