html_compare_rs

Macro assert_html_eq

Source
macro_rules! assert_html_eq {
    ($left:expr, $right:expr $(,)?) => { ... };
    ($left:expr, $right:expr, $options:expr $(,)?) => { ... };
}
Expand description

Asserts that two HTML strings are equivalent according to the given comparison options.

§Examples

use html_compare::assert_html_eq;

assert_html_eq!(
    "<div><p>Hello</p></div>",
    "<div>\n  <p>Hello</p>\n</div>"
);

// With custom options
use html_compare::HtmlCompareOptions;
assert_html_eq!(
    "<div><p>First</p><p>Second</p></div>",
    "<div><p>Second</p><p>First</p></div>",
    HtmlCompareOptions {
        ignore_sibling_order: true,
        ..Default::default()
    }
);