Skip to content

Commit

Permalink
test(dynamic string): test pango attributes with ironvars
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeStanger committed Jan 25, 2024
1 parent 4d9d78f commit af7e037
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/dynamic_value/dynamic_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>"))
}
}

0 comments on commit af7e037

Please sign in to comment.