Fix windows chooser invocation error message test (#1079)

This commit is contained in:
Casey Rodarmor 2022-01-30 12:32:38 -08:00 committed by GitHub
parent 27cd8fd554
commit b95e32c9be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -125,11 +125,7 @@ fn invoke_error_function() {
echo bar
",
)
.stderr(if cfg!(windows) {
"error: Chooser `/ -cu fzf` invocation failed: Access is denied. (os error 5)\n"
} else {
"error: Chooser `/ -cu fzf` invocation failed: Permission denied (os error 13)\n"
})
.stderr_regex("error: Chooser `/ -cu fzf` invocation failed: .*")
.status(EXIT_FAILURE)
.shell(false)
.args(&["--shell", "/", "--choose"])

View File

@ -125,7 +125,7 @@ impl Test {
}
pub(crate) fn stderr_regex(mut self, stderr_regex: impl AsRef<str>) -> Self {
self.stderr_regex = Some(Regex::new(&format!("^{}$", stderr_regex.as_ref())).unwrap());
self.stderr_regex = Some(Regex::new(&format!("(?m)^{}$", stderr_regex.as_ref())).unwrap());
self
}
@ -223,7 +223,7 @@ impl Test {
if let Some(ref stderr_regex) = self.stderr_regex {
if !stderr_regex.is_match(output_stderr) {
panic!(
"Stderr regex mismatch: {} !~= /{}/",
"Stderr regex mismatch:\n{:?}\n!~=\n/{:?}/",
output_stderr, stderr_regex
);
}