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

25
tests/tests_divisions.rs Normal file
View File

@@ -0,0 +1,25 @@
#[cfg(test)]
mod tests {
use web_macro::{division, heading1};
#[test]
fn test_base() {
assert_eq!("<div>test</div>", division!("test"))
}
#[test]
fn test_multiple_elements() {
assert_eq!(
"<div>\n<h1>one</h1>\n<h1>two</h1>\n</div>",
division!(heading1!("one"), heading1!("two"))
)
}
#[test]
fn test_multiple_elements_with_options() {
assert_eq!(
"<div id=\"division_id\">\n<h1>one</h1>\n<h1 class=\"tiny\">two</h1>\n</div>",
division!(heading1!("one"), heading1!("two", class="tiny"), id="division_id")
)
}
}

13
tests/tests_paragraphs.rs Normal file
View File

@@ -0,0 +1,13 @@
#[cfg(test)]
mod tests {
use web_macro::paragraph;
#[test]
fn test_base() {
assert_eq!("<p>test</p>", paragraph!("test"))
}
#[test]
fn test_params() {
assert_eq!("<p id=\"oui\">test</p>", paragraph!("test", id = "oui"))
}
}