Add more tests

This commit is contained in:
elkowar 2020-10-21 19:58:01 +02:00
parent 4ddbea7194
commit 4a4b0a3343
3 changed files with 4 additions and 3 deletions

View file

@ -36,7 +36,7 @@ impl StateChangeHandler {
util::print_result_err("while updating UI based after state change", &result);
}
Err(err) => {
eprintln!("Error whiel resolving attributes {:?}", err);
eprintln!("Error while resolving attributes: {:?}", err);
}
}
}

View file

@ -122,6 +122,7 @@ impl ScriptVarHandler {
))?;
} else if event.hangup {
command_out_handles.remove(var_name);
sources.unregister(var_name);
}
}
};

View file

@ -154,14 +154,14 @@ mod test {
use pretty_assertions::assert_eq;
#[test]
fn test_parse_string_or_var_ref_list() {
let input = "{{foo}}{{bar}}b{}az{{bat}}{}quok{{test}}";
let input = "{{foo}}{{bar}}b{}azb{a}z{{bat}}{}quok{{test}}";
let output = AttrValue::parse_string(input);
assert_eq!(
output,
AttrValue(vec![
AttrValueElement::VarRef(VarName("foo".to_owned())),
AttrValueElement::VarRef(VarName("bar".to_owned())),
AttrValueElement::primitive("b{}az".to_owned()),
AttrValueElement::primitive("b{}azb{a}z".to_owned()),
AttrValueElement::VarRef(VarName("bat".to_owned())),
AttrValueElement::primitive("{}quok".to_owned()),
AttrValueElement::VarRef(VarName("test".to_owned())),