cargo_test_support::publish

Function validate_crate_contents

source
pub fn validate_crate_contents(
    reader: impl Read,
    expected_crate_name: &str,
    expected_files: &[&str],
    expected_contents: &[(&str, &str)],
)
Expand description

Checks the contents of a .crate file.

  • expected_crate_name should be something like foo-0.0.1.crate.
  • expected_files should be a complete list of files in the crate (relative to expected_crate_name).
  • expected_contents should be a list of (file_name, contents) tuples to validate the contents of the given file. Only the listed files will be checked (others will be ignored).