aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-09-29 14:56:31 +0200
committerTeddy Wing2018-09-29 14:56:31 +0200
commite776f725a64c530e45e5f113f2fd1b7f15665850 (patch)
treeaeecc9d5988f6fa2d1dc72a55574759f04d76d10
parentb02e7366c3c4b9edb5afa0d012952fad369b66a9 (diff)
downloaddome-key-map-e776f725a64c530e45e5f113f2fd1b7f15665850.tar.bz2
parser: Correct tests to use new `Action` enum type
Fix these tests that were based on the `String` version of `Action`, before b02e7366c3c4b9edb5afa0d012952fad369b66a9.
-rw-r--r--src/parser.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 6ac52f1..148187f 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -366,7 +366,7 @@ mod tests {
fn action_parses_string_to_end_of_line() {
let text = "/usr/bin/say 'hello'
";
- let expected: Action = "/usr/bin/say 'hello'".to_owned();
+ let expected: Action = Action::String("/usr/bin/say 'hello'".to_owned());
let result = action().parse(text).map(|t| t.0);
assert_eq!(result, Ok(expected));
@@ -378,7 +378,7 @@ mod tests {
";
let expected = Map {
trigger: vec![HeadphoneButton::Play, HeadphoneButton::Down],
- action: "test".to_owned(),
+ action: Action::String("test".to_owned()),
kind: MapKind::Map,
};
let result = map().parse(text).map(|t| t.0);
@@ -404,21 +404,21 @@ cmd <down> /usr/bin/say 'hello'
expected.insert(
vec![HeadphoneButton::Up, HeadphoneButton::Down],
MapAction {
- action: "test".to_owned(),
+ action: Action::String("test".to_owned()),
kind: MapKind::Map,
},
);
expected.insert(
vec![HeadphoneButton::Play],
MapAction {
- action: "salt and pepper".to_owned(),
+ action: Action::String("salt and pepper".to_owned()),
kind: MapKind::Map,
},
);
expected.insert(
vec![HeadphoneButton::Down],
MapAction {
- action: "/usr/bin/say 'hello'".to_owned(),
+ action: Action::String("/usr/bin/say 'hello'".to_owned()),
kind: MapKind::Command,
},
);
@@ -442,14 +442,14 @@ cmd <down> /usr/bin/say 'hello'
expected.maps.insert(
vec![HeadphoneButton::Up, HeadphoneButton::Play],
MapAction {
- action: "echo hello".to_owned(),
+ action: Action::String("echo hello".to_owned()),
kind: MapKind::Command,
},
);
expected.maps.insert(
vec![HeadphoneButton::Down],
MapAction {
- action: "insert {}".to_owned(),
+ action: Action::String("insert {}".to_owned()),
kind: MapKind::Map,
},
);
@@ -477,7 +477,7 @@ map <down> k
mode_up_maps.insert(
vec![HeadphoneButton::Down],
MapAction {
- action: "j".to_owned(),
+ action: Action::String("j".to_owned()),
kind: MapKind::Command,
}
);
@@ -486,7 +486,7 @@ map <down> k
mode_down_up_maps.insert(
vec![HeadphoneButton::Down],
MapAction {
- action: "j".to_owned(),
+ action: Action::String("j".to_owned()),
kind: MapKind::Command,
}
);
@@ -498,7 +498,7 @@ map <down> k
}),
Definition::Map(Map {
trigger: vec![HeadphoneButton::Play],
- action: "m".to_owned(),
+ action: Action::String("m".to_owned()),
kind: MapKind::Map,
}),
Definition::Mode(Mode {
@@ -507,7 +507,7 @@ map <down> k
}),
Definition::Map(Map {
trigger: vec![HeadphoneButton::Down],
- action: "k".to_owned(),
+ action: Action::String("k".to_owned()),
kind: MapKind::Map,
}),
];
@@ -537,14 +537,14 @@ cmd <play> /usr/bin/say hello
maps.insert(
vec![HeadphoneButton::Down],
MapAction {
- action: "/bin/echo nothing".to_owned(),
+ action: Action::String("/bin/echo nothing".to_owned()),
kind: MapKind::Command,
},
);
maps.insert(
vec![HeadphoneButton::Play],
MapAction {
- action: "/usr/bin/say hello".to_owned(),
+ action: Action::String("/usr/bin/say hello".to_owned()),
kind: MapKind::Command,
},
);
@@ -552,7 +552,7 @@ cmd <play> /usr/bin/say hello
mode_maps.insert(
vec![HeadphoneButton::Play],
MapAction {
- action: "p".to_owned(),
+ action: Action::String("p".to_owned()),
kind: MapKind::Map,
},
);