Skip to content

Commit

Permalink
refactor(mrml-core): more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jérémie Drouet <[email protected]>
  • Loading branch information
jdrouet committed Jul 30, 2023
1 parent 2e0dee8 commit 82ee5af
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/mrml-core/src/mj_navbar_link/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,37 @@ impl<'a> ElementParser<'a, MjNavbarLink> for MrmlParser<'a> {
})
}
}

#[cfg(test)]
mod tests {
use super::MjNavbarLink;
use crate::prelude::parser::MrmlParser;

macro_rules! assert_success {
($title:ident, $template:expr) => {
#[test]
fn $title() {
let _: MjNavbarLink = MrmlParser::new($template, Default::default())
.parse_root()
.unwrap();
}
};
}

assert_success!(should_handle_empty_children, "<mj-navbar-link />");

assert_success!(
should_handle_comments,
"<mj-navbar-link><!-- comment --></mj-navbar-link>"
);

assert_success!(
should_work_with_text,
"<mj-navbar-link>Hello</mj-navbar-link>"
);

assert_success!(
should_work_with_other_element,
"<mj-navbar-link><span /></mj-navbar-link>"
);
}

0 comments on commit 82ee5af

Please sign in to comment.