First commit
This commit is contained in:
54
tests/tests.rs
Normal file
54
tests/tests.rs
Normal file
@@ -0,0 +1,54 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use web_macro::*;
|
||||
|
||||
#[test]
|
||||
fn test_function() {
|
||||
assert_eq!("<h1>test</h1>", heading1!(String::from("test")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_literal() {
|
||||
assert_eq!("<h1>test</h1>", heading1!("test"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_recursive() {
|
||||
assert_eq!("<h1><h1>test</h1></h1>", heading1!(heading1!("test")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_options_literal() {
|
||||
assert_eq!(
|
||||
"<h1 id=\"oui\" class=\"test\">test</h1>",
|
||||
heading1!("test", id = "oui", class = "test")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_options_functional() {
|
||||
assert_eq!(
|
||||
"<h1 id=\"oui\" class=\"test\" pseudo=\"adolf\">test</h1>",
|
||||
heading1!(
|
||||
"test",
|
||||
id = String::from("oui"),
|
||||
class = String::from("test"),
|
||||
pseudo = {
|
||||
let mut s = String::new();
|
||||
s.push_str("adolf");
|
||||
s
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_level() {
|
||||
assert_eq!("<h2>test</h2>", heading2!("test"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_level_options() {
|
||||
assert_eq!("<h3 id=\"oui\">test</h3>", heading3!("test", id = "oui"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user