Skip to content

Commit

Permalink
Add tests for issue lambda-fairy#21
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo157 committed Feb 2, 2016
1 parent 1bf05f6 commit 244bd91
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions maud_macros/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,30 @@ fn issue_26_3() {
let s = to_string!(p { "Hi, " ^{"person called ".to_string() + name} "!" });
assert_eq!(s, "<p>Hi, person called Lyra!</p>");
}

#[test]
fn issue_21() {
macro_rules! greet {
() => ({
let mut result = String::new();
let name = "Pinkie Pie";
html!(result, p { "Hello, " ^name "!" }).map(|()| result)
})
}

let s = greet!().unwrap();
assert_eq!(s, "<p>Hello, Pinkie Pie!</p>");
}

#[test]
fn issue_21_2() {
macro_rules! greet {
($name:expr) => ({
let mut result = String::new();
html!(result, p { "Hello, " ^$name "!" }).map(|()| result)
})
}

let s = greet!("Pinkie Pie").unwrap();
assert_eq!(s, "<p>Hello, Pinkie Pie!</p>");
}

0 comments on commit 244bd91

Please sign in to comment.