macro_rules! assert_html_root_url_updated {
    ($path:expr) => { ... };
}
Expand description

Assert that the html_root_url attribute is up to date.

Library crates can set html_root_url to point to their documentation so that cargo doc --no-deps in other projects can generate correct links when referring the library.

The macro will call check_html_root_url on the file name given in order to check that the html_root_url is points to the current version of your package documentation on docs.rs. Use assert_contains_regex! instead if you don’t host the documentation on docs.rs.

The package name is automatically taken from the $CARGO_PKG_NAME environment variable and the version is taken from $CARGO_PKG_VERSION. These environment variables are automatically set by Cargo when compiling your crate.

This macro is enabled by the html_root_url_updated feature.

Usage

The typical way to use this macro is from an integration test:

#[test]
fn test_html_root_url() {
    version_sync::assert_html_root_url_updated!("src/lib.rs");
}

Tests are run with the current directory set to directory where your Cargo.toml file is, so this will find the src/lib.rs crate root.

Panics

If the html_root_url fails the check, panic! will be invoked.