Improve testing

This commit is contained in:
hodasemi 2024-04-04 10:35:00 +02:00
parent a4f0c0bcc8
commit ce84cc52d8

View file

@ -31,8 +31,17 @@ callbacks!(SelectCallbacks, Fn(bool) -> anyhow::Result<()> + Send + Sync);
callbacks!(CustomCallbacks, Fn(ControllerButton) -> anyhow::Result<bool> + Send + Sync); callbacks!(CustomCallbacks, Fn(ControllerButton) -> anyhow::Result<bool> + Send + Sync);
callbacks!(VecCallbacks, Fn(&dyn Any) -> Result<()> + Send + Sync); callbacks!(VecCallbacks, Fn(&dyn Any) -> Result<()> + Send + Sync);
#[test] #[cfg(test)]
fn test_click_callback_builder() { mod test {
use super::*;
use anyhow::Result;
fn normal_fn() -> impl Fn() -> Result<()> + Send + Sync {
|| Ok(())
}
#[test]
fn test_click_callback_builder() {
struct Test; struct Test;
impl Test { impl Test {
@ -46,10 +55,8 @@ fn test_click_callback_builder() {
let t = Test; let t = Test;
let cbs = ClickCallbacks::default().add("test", || { let cbs = ClickCallbacks::default().add("normal_test", normal_fn());
println!("hello world!");
Ok(())
});
t.set_click_callbacks(cbs.into()).unwrap(); t.set_click_callbacks(cbs.into()).unwrap();
}
} }