Files
dioxus/packages/core/tests/error_boundary.rs
T
2024-01-10 17:57:15 -06:00

35 lines
600 B
Rust

#![allow(non_snake_case)]
use dioxus::prelude::*;
#[test]
fn catches_panic() {
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
}
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div {
h1 { "Title" }
NoneChild {}
ThrowChild {}
}
})
}
fn NoneChild(_cx: Scope) -> Element {
None
}
fn ThrowChild(cx: Scope) -> Element {
Err(std::io::Error::new(std::io::ErrorKind::AddrInUse, "asd")).throw()?;
let _g: i32 = "123123".parse().throw()?;
cx.render(rsx! {
div {}
})
}