macro_rules! assert_fs_read_to_string_matches {
    ($path:expr, $matcher:expr $(,)?) => { ... };
    ($path:expr, $matcher:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a std::fs::read_to_string(path) is a match to a regex.

Pseudocode:
std::fs::read_to_string(path) matches expr

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use std::io::Read;
use regex::Regex;

let path = "alfa.txt";
let matcher = Regex::new(r"alfa").unwrap();
assert_fs_read_to_string_matches!(&path, &matcher);

let path = "alfa.txt";
let matcher = Regex::new(r"zzz").unwrap();
assert_fs_read_to_string_matches!(&path, &matcher);
// assertion failed: `assert_fs_read_to_string_matches!(path, matcher)`
// https://docs.rs/assertables/8.7.0/assertables/macro.assert_fs_read_to_string_matches.html
//     path label: `&path`,
//     path debug: `\"alfa.txt\"`,
//  matcher label: `&matcher`,
//  matcher debug: `Regex(\"zzz\")`,
//    read string: `\"alfa\\n\"`

§Module macros