1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 19:34:24 +02:00

test(dynamic string): test pango attributes with ironvars

This commit is contained in:
Jake Stanger 2024-01-25 22:22:16 +00:00
parent 4d9d78f4ca
commit af7e037dd5
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61

View file

@ -316,4 +316,18 @@ mod tests {
matches!(&tokens[0], DynamicStringSegment::Script(script) if script.cmd == "echo #hello")
);
}
#[test]
fn test_pango_attribute() {
const INPUT: &str = "<span color='#color'>hello</span>";
let (tokens, _) = parse_input(INPUT);
assert_eq!(tokens.len(), 3);
assert!(matches!(&tokens[0], DynamicStringSegment::Static(str) if str == "<span color='"));
assert!(
matches!(&tokens[1], DynamicStringSegment::Variable(var) if var.to_string() == "color")
);
assert!(matches!(&tokens[2], DynamicStringSegment::Static(str) if str == "'>hello</span>"))
}
}