thing-tui: pin tolerate and the meta modifiers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f1c5978d77
commit
482fdd42cf
2 changed files with 12 additions and 1 deletions
|
|
@ -156,7 +156,9 @@ fn chain_panic_hook(first: impl Fn() + Send + Sync + 'static) {
|
|||
mod tests {
|
||||
use std::sync::Mutex;
|
||||
|
||||
use super::chain_panic_hook;
|
||||
use std::io;
|
||||
|
||||
use super::{chain_panic_hook, tolerate};
|
||||
|
||||
static ORDER: Mutex<Vec<&'static str>> = Mutex::new(Vec::new());
|
||||
|
||||
|
|
@ -171,4 +173,12 @@ mod tests {
|
|||
assert!(caught.is_err());
|
||||
assert_eq!(*ORDER.lock().unwrap(), ["restore", "previous"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_an_unsupported_mode_is_tolerated() {
|
||||
assert!(tolerate(Ok(())).is_ok());
|
||||
assert!(tolerate(Err(io::Error::from(io::ErrorKind::Unsupported))).is_ok());
|
||||
let other = tolerate(Err(io::Error::from(io::ErrorKind::BrokenPipe))).unwrap_err();
|
||||
assert_eq!(other.kind(), io::ErrorKind::BrokenPipe);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ fn modifiers_are_carried_each_on_its_own() {
|
|||
(KeyModifiers::ALT, Modifiers { alt: true, ..NONE }),
|
||||
(KeyModifiers::SUPER, Modifiers { meta: true, ..NONE }),
|
||||
(KeyModifiers::META, Modifiers { meta: true, ..NONE }),
|
||||
(KeyModifiers::SUPER | KeyModifiers::META, Modifiers { meta: true, ..NONE }),
|
||||
(KeyModifiers::HYPER, NONE),
|
||||
] {
|
||||
let events = translate(&key(KeyCode::Down, flag, KeyEventKind::Press));
|
||||
|
|
|
|||
Loading…
Reference in a new issue