revert: remove alias tests

main
Angelo Fallaria 2 years ago
parent da5e14d761
commit 71b7faf138

@ -1301,109 +1301,6 @@ super + {a-}
{firefox, brave}";
eval_invalid_config_test(contents, ParseError::UnknownSymbol(2))
}
#[test]
fn test_alias() -> std::io::Result<()> {
let contents = "
alias ctal = control + alt
alias pls =doas
ctal + t
pls firefox # why always firefox
alias ctals = ctal + shift
ctals + t
brave";
eval_config_test(
contents,
vec![
Hotkey::new(
evdev::Key::KEY_T,
vec![Modifier::Control, Modifier::Alt],
"doas firefox # why always firefox".to_string(),
),
Hotkey::new(
evdev::Key::KEY_T,
vec![Modifier::Control, Modifier::Alt, Modifier::Shift],
"brave".to_string(),
),
],
)
}
#[test]
fn test_invalid_alias() -> std::io::Result<()> {
let contents = "
alias ctal = control + alt =
ctal +t
firefox";
eval_invalid_config_test(contents, ParseError::UnknownSymbol(3))
}
#[test]
fn test_not_an_alias() -> std::io::Result<()> {
let contents = "
alias ctal # nothing here
ctal + t
firefox";
eval_invalid_config_test(contents, ParseError::UnknownSymbol(2))
}
#[test]
fn test_alias_comment() -> std::io::Result<()> {
let contents = "
alias ctal = # no inline comment support for alias statement yet.
# will be '# no inline comment support for alias statement yet. + t' here
ctal + t
firefox";
eval_invalid_config_test(contents, ParseError::UnknownSymbol(5))
}
#[test]
fn test_longer_alias_example() -> std::io::Result<()> {
let contents = "
# Longer example
alias pls=doas
alias ctal = control + alt
alias ctals = ctal + shift
alias hello = #hello
ctal + f hello
firefox
ctals + b
brave hello";
eval_config_test(
contents,
vec![
Hotkey::new(
evdev::Key::KEY_F,
vec![Modifier::Control, Modifier::Alt],
"firefox".to_string(),
),
Hotkey::new(
evdev::Key::KEY_B,
vec![Modifier::Control, Modifier::Alt, Modifier::Shift],
"brave #hello".to_string(),
),
],
)
}
#[test]
fn test_none() -> std::io::Result<()> {
let contents = "
super + {_, shift} + b
{firefox, brave}";
eval_config_test(
contents,
vec![
Hotkey::new(evdev::Key::KEY_B, vec![Modifier::Super], "firefox".to_string()),
Hotkey::new(
evdev::Key::KEY_B,
vec![Modifier::Super, Modifier::Shift],
"brave".to_string(),
),
],
)
}
}
#[cfg(test)]

Loading…
Cancel
Save