wip: add tests and slightly refactor interpreter code

This commit is contained in:
Jonathan Kelley committed 2024-02-23 17:38:04 -08:00
1 parent e0b0afc0a9
commit 53cafefdef
5 files changed
+570 -414

No files matched your search

+4 -21
View File
@@ -2,28 +2,11 @@ use dioxus::prelude::*;
use dioxus_core::Element;
use dioxus_desktop::DesktopContext;
#[path = "./utils.rs"]
mod utils;
fn main() {
check_app_exits(check_html_renders);
}
pub(crate) fn check_app_exits(app: fn() -> Element) {
use dioxus_desktop::Config;
use tao::window::WindowBuilder;
// This is a deadman's switch to ensure that the app exits
let should_panic = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(true));
let should_panic_clone = should_panic.clone();
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_secs(5));
if should_panic_clone.load(std::sync::atomic::Ordering::SeqCst) {
std::process::exit(exitcode::SOFTWARE);
}
});
LaunchBuilder::desktop()
.with_cfg(Config::new().with_window(WindowBuilder::new().with_visible(true)))
.launch(app);
should_panic.store(false, std::sync::atomic::Ordering::SeqCst);
utils::check_app_exits(check_html_renders);
}
fn use_inner_html(id: &'static str) -> Option<String> {