From 827ed2e58531e5483a90f74798ea754cbcade3cb Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 30 Mar 2019 11:20:14 +0100 Subject: [PATCH] tests: ensure version numbers in README are always up to date This adds a test that will check the examples in README.md for the current package version. It also checks that there is a Markdown heading mentioning (at least) the current version. This serves as a simple check that the change log section is updated when the version number is bumped. Related to #30, #41, #47, and #48. --- Cargo.toml | 1 + tests/version-numbers.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/version-numbers.rs diff --git a/Cargo.toml b/Cargo.toml index 9ad7ef8..239392f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,3 +23,4 @@ no_std = [] # This is a no-op, preserved for backward compatibility only. [dev-dependencies] quickcheck = "0.7" +version-sync = "0.8" diff --git a/tests/version-numbers.rs b/tests/version-numbers.rs new file mode 100644 index 0000000..e8be955 --- /dev/null +++ b/tests/version-numbers.rs @@ -0,0 +1,14 @@ +#[test] +fn test_readme_deps() { + version_sync::assert_markdown_deps_updated!("README.md"); +} + +#[test] +fn test_readme_changelog() { + version_sync::assert_contains_regex!("README.md", r"^## {version}$"); +} + +#[test] +fn test_html_root_url() { + version_sync::assert_html_root_url_updated!("src/lib.rs"); +}