From 4a4b0a334349393983f2d937acdf163494906770 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Wed, 21 Oct 2020 19:58:01 +0200 Subject: [PATCH] Add more tests --- src/eww_state.rs | 2 +- src/script_var_handler.rs | 1 + src/value/attr_value.rs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/eww_state.rs b/src/eww_state.rs index 5674722..b8f67c2 100644 --- a/src/eww_state.rs +++ b/src/eww_state.rs @@ -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); } } } diff --git a/src/script_var_handler.rs b/src/script_var_handler.rs index 52ffb2d..4f7cd35 100644 --- a/src/script_var_handler.rs +++ b/src/script_var_handler.rs @@ -122,6 +122,7 @@ impl ScriptVarHandler { ))?; } else if event.hangup { command_out_handles.remove(var_name); + sources.unregister(var_name); } } }; diff --git a/src/value/attr_value.rs b/src/value/attr_value.rs index 2360733..6838bf4 100644 --- a/src/value/attr_value.rs +++ b/src/value/attr_value.rs @@ -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())),