macro_rules! assert_fs_read_to_string_contains { ($path:expr, $containee:expr $(,)?) => { ... }; ($path:expr, $containee:expr, $($message:tt)+) => { ... }; }
Expand description
Assert a std::fs::read_to_string() contains a pattern.
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use std::io::Read;
let path = "alfa.txt";
let containee = "alfa";
assert_fs_read_to_string_contains!(&path, &containee);
let path = "alfa.txt";
let containee = "zzz";
assert_fs_read_to_string_contains!(&path, &containee);
// assertion failed: `assert_fs_read_to_string_contains!(path, containee)`
// path label: `&path`,
// path debug: `\"alfa.txt\"`,
// containee label: `&containee`,
// containee debug: `\"zzz\"`,
// read string: `\"alfa\\n\"`