aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
authorTeddy Wing2018-10-18 04:55:44 +0200
committerTeddy Wing2018-10-18 04:55:44 +0200
commit7e21e54447846d182f02c25d285a25c992c9f775 (patch)
treece5610bb965cfb8eaf11065bcb4cb0afdb85f885 /src/parser.rs
parentcaea7bde66206d151075b11a33cc0ac446d448ab (diff)
downloaddome-key-map-7e21e54447846d182f02c25d285a25c992c9f775.tar.bz2
parser: Add a basic test for `NXKey` parsing
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 2473eee..0cfac2e 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -887,6 +887,25 @@ mod tests {
}
#[test]
+ fn action_parses_map_with_nx_key() {
+ let text = "<A-Play><Enter>";
+
+ let expected = Action::Map(vec![
+ KeyboardKeyWithModifiers::new(
+ KeyboardKey::NXKey(key_code::NX_KEYTYPE_PLAY),
+ vec![Flag::Alt],
+ ),
+ KeyboardKeyWithModifiers::new(
+ KeyboardKey::KeyCode(KeyCode::new(autopilot::key::KeyCode::Return)),
+ vec![],
+ ),
+ ]);
+ let result = action_map().easy_parse(text).map(|t| t.0);
+
+ assert_eq!(result, Ok(expected));
+ }
+
+ #[test]
fn action_parses_map_with_backslash_escape() {
let text = "type\\\\onebslash";