Add assert_not_contains
to run-make-support
library
This commit is contained in:
parent
c0d600385b
commit
56733372b8
1 changed files with 11 additions and 0 deletions
|
@ -268,6 +268,17 @@ pub fn recursive_diff(dir1: impl AsRef<Path>, dir2: impl AsRef<Path>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Check that `haystack` does not contain `needle`. Panic otherwise.
|
||||
pub fn assert_not_contains(haystack: &str, needle: &str) {
|
||||
if haystack.contains(needle) {
|
||||
eprintln!("=== HAYSTACK ===");
|
||||
eprintln!("{}", haystack);
|
||||
eprintln!("=== NEEDLE ===");
|
||||
eprintln!("{}", needle);
|
||||
panic!("needle was unexpectedly found in haystack");
|
||||
}
|
||||
}
|
||||
|
||||
/// Implement common helpers for command wrappers. This assumes that the command wrapper is a struct
|
||||
/// containing a `cmd: Command` field and a `output` function. The provided helpers are:
|
||||
///
|
||||
|
|
Loading…
Add table
Reference in a new issue