verso-reader 0.1.0

A terminal EPUB reader with vim navigation, a Kindle-style library, and Markdown highlight export
Documentation
use verso::ui::keymap::{
    defaults,
    table::{Dispatch, Keymap},
    Action,
};

#[test]
fn default_keymap_binds_colon_to_begin_cmd() {
    let entries = defaults::default_entries();
    let km = Keymap::from_config(&entries).unwrap();
    assert!(
        matches!(km.feed(":"), Dispatch::Fire(Action::BeginCmd)),
        "expected `:` to dispatch BeginCmd from the default keymap"
    );
}

#[test]
fn cmd_action_parses_from_config_string() {
    let km = Keymap::from_config(&[("cmd".into(), vec![":".into()])]).unwrap();
    assert!(matches!(km.feed(":"), Dispatch::Fire(Action::BeginCmd)));
}