diff options
| author | Teddy Wing | 2018-10-01 01:42:18 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-10-01 01:42:18 +0200 |
| commit | 45e173176a0d4b44c9b1bf3cc7a880929d1360a6 (patch) | |
| tree | c45d21ef5ea14910b809095b8b4ce8ef4a5b325e /src | |
| parent | 9af04b96a475777d2e177b2a55d5b4f7705244aa (diff) | |
| download | dome-key-map-45e173176a0d4b44c9b1bf3cc7a880929d1360a6.tar.bz2 | |
Fill in `action_parses_map_with_simple_characters()` test
A simple test to check parsing of a simple string without any special
keys or modifiers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/parser.rs | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs index 51e15d8..a84aba1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -580,7 +580,57 @@ mod tests { #[test] fn action_parses_map_with_simple_characters() { - // "type hello!" + let text = "type hello!"; + + let expected = Action::Map(vec![ + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('t')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('y')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('p')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('e')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new(' ')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('h')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('e')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('l')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('l')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('o')), + None, + ), + KeyboardKeyWithModifiers::new( + KeyboardKey::Character(Character::new('!')), + None, + ), + ]); + let result = action_map().easy_parse(text).map(|t| t.0); + + assert_eq!(result, Ok(expected)); } #[test] |
