Add test for match inside an attribute
This commit is contained in:
parent
b254d7fbc4
commit
f35707cce0
1 changed files with 15 additions and 1 deletions
|
@ -283,7 +283,6 @@ mod control {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_expr_with_guards() {
|
fn match_expr_with_guards() {
|
||||||
for &(input, output) in [(Some(1), "one"), (None, "none"), (Some(2), "2")].iter() {
|
for &(input, output) in [(Some(1), "one"), (None, "none"), (Some(2), "2")].iter() {
|
||||||
|
@ -298,6 +297,21 @@ mod control {
|
||||||
assert_eq!(s, output);
|
assert_eq!(s, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn match_in_attribute() {
|
||||||
|
for &(input, output) in [(1, "<span class=\"one\">1</span>"), (2, "<span class=\"two\">2</span>"), (3, "<span class=\"many\">3</span>")].iter() {
|
||||||
|
let mut s = String::new();
|
||||||
|
html!(s, {
|
||||||
|
span class=@match input {
|
||||||
|
1 => "one",
|
||||||
|
2 => "two",
|
||||||
|
_ => "many",
|
||||||
|
} { ^input }
|
||||||
|
}).unwrap();
|
||||||
|
assert_eq!(s, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Reference in a new issue