mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
This commit is contained in:
parent
17506726cb
commit
c8827b43c3
9 changed files with 114 additions and 135 deletions
|
|
@ -1,14 +1,12 @@
|
|||
use crate::*;
|
||||
|
||||
#[test] fn test_subcommand () -> Usually<()> {
|
||||
use crate::input::{Command, Handle, handle};
|
||||
//use crate::dsl::TokenIter;
|
||||
use crate::tui::TuiIn;
|
||||
use crossterm::event::{Event, KeyEvent, KeyCode, KeyModifiers, KeyEventKind, KeyEventState};
|
||||
//use crate::input::*;
|
||||
//use crate::dsl::*;
|
||||
use crate::input::*;
|
||||
use crate::dsl::*;
|
||||
struct Test {
|
||||
//keys: InputMap<'static, Test, TestCommand, TuiIn, TokenIter<'static>>
|
||||
keys: InputLayers
|
||||
}
|
||||
handle!(TuiIn: |self: Test, input|if let Some(command) = self.keys.command(self, input) {
|
||||
Ok(Some(true))
|
||||
|
|
@ -37,12 +35,12 @@ use crate::*;
|
|||
}
|
||||
}
|
||||
let mut test = Test {
|
||||
keys: InputMap::new("
|
||||
keys: InputLayers::new(SourceIter::new("
|
||||
(@a do-thing)
|
||||
(@b do-thing-arg 0)
|
||||
(@c do-sub do-other-thing)
|
||||
(@d do-sub do-other-thing-arg 0)
|
||||
".into())
|
||||
".into()))
|
||||
};
|
||||
assert_eq!(Some(true), test.handle(&TuiIn(Default::default(), Event::Key(KeyEvent {
|
||||
kind: KeyEventKind::Press,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue