Modified tests to reflect additions in the macros

This commit is contained in:
2026-03-02 23:33:22 +01:00
parent fe59a1e444
commit 6be8c58d03
3 changed files with 38 additions and 0 deletions

54
tests/tests_headings.rs Normal file
View 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"))
}
}