Macro version_sync::assert_html_root_url_updated [] [src]

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

Assert that the html_root_url attribute is up to date.

Library code is expected to set html_root_url to point to docs.rs so that rustdoc can generate correct links when referring to this crate.

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. 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.

Usage

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

#[macro_use]
extern crate version_sync;

#[test]
fn test_html_root_url() {
    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.