mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
cleanup + update tests; add 'just test'
This commit is contained in:
parent
62a0e8c17c
commit
4ae31bbba0
11 changed files with 45 additions and 1470 deletions
|
|
@ -60,7 +60,7 @@ pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
|
|||
fn area_mut (&mut self) -> &mut [u16;4] {
|
||||
&mut self.0
|
||||
}
|
||||
fn place (&mut self, _: [u16;4], _: &impl Content<TestEngine>) {
|
||||
fn place (&mut self, _: [u16;4], _: &impl Render<TestEngine>) {
|
||||
()
|
||||
}
|
||||
}
|
||||
|
|
@ -71,25 +71,3 @@ pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_tui_engine () -> Usually<()> {
|
||||
use crate::tui::*;
|
||||
use std::sync::{Arc, RwLock};
|
||||
struct TestComponent(String);
|
||||
impl Content<Tui> for TestComponent {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
Some(self.0.as_str())
|
||||
}
|
||||
}
|
||||
impl Handle<Tui> for TestComponent {
|
||||
fn handle (&mut self, from: &TuiIn) -> Perhaps<bool> {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
let engine = Tui::new()?;
|
||||
engine.read().unwrap().exited.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||
let state = TestComponent("hello world".into());
|
||||
let state = std::sync::Arc::new(std::sync::RwLock::new(state));
|
||||
engine.run(&state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue