Fix error message tests for Alpine Linux (#956)
This commit is contained in:
parent
dbf142369b
commit
4f9a77fff6
@ -160,9 +160,10 @@ fn status_error() {
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
String::from_utf8_lossy(&output.stderr),
|
||||
"error: Chooser `exit-2` failed: exit code: 2\n",
|
||||
assert!(
|
||||
Regex::new("^error: Chooser `exit-2` failed: exit (code|status): 2\n$")
|
||||
.unwrap()
|
||||
.is_match(str::from_utf8(&output.stderr).unwrap())
|
||||
);
|
||||
|
||||
assert_eq!(output.status.code().unwrap(), 2);
|
||||
|
@ -91,7 +91,7 @@ test! {
|
||||
echo XYZ
|
||||
",
|
||||
args: ("--command", "false"),
|
||||
stderr: "error: Command `false` failed: exit code: 1\n",
|
||||
stderr_regex: "error: Command `false` failed: exit (code|status): 1\n",
|
||||
status: EXIT_FAILURE,
|
||||
}
|
||||
|
||||
|
@ -79,9 +79,10 @@ fn status_error() {
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
String::from_utf8_lossy(&output.stderr),
|
||||
"error: Editor `exit-2` failed: exit code: 2\n"
|
||||
assert!(
|
||||
Regex::new("^error: Editor `exit-2` failed: exit (code|status): 2\n$")
|
||||
.unwrap()
|
||||
.is_match(str::from_utf8(&output.stderr).unwrap(),)
|
||||
);
|
||||
|
||||
assert_eq!(output.status.code().unwrap(), 2);
|
||||
|
@ -3,17 +3,18 @@ use crate::common::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
macro_rules! test {
|
||||
(
|
||||
name: $name:ident,
|
||||
{
|
||||
name: $name:ident,
|
||||
$(justfile: $justfile:expr,)?
|
||||
$(args: ($($arg:tt),*),)?
|
||||
$(env: { $($env_key:literal : $env_value:literal,)* },)?
|
||||
$(stdin: $stdin:expr,)?
|
||||
$(stdout: $stdout:expr,)?
|
||||
$(stderr: $stderr:expr,)?
|
||||
$(status: $status:expr,)?
|
||||
$(shell: $shell:expr,)?
|
||||
) => {
|
||||
$(args: ($($arg:tt),*),)?
|
||||
$(env: { $($env_key:literal : $env_value:literal,)* },)?
|
||||
$(stdin: $stdin:expr,)?
|
||||
$(stdout: $stdout:expr,)?
|
||||
$(stderr: $stderr:expr,)?
|
||||
$(stderr_regex: $stderr_regex:expr,)?
|
||||
$(status: $status:expr,)?
|
||||
$(shell: $shell:expr,)?
|
||||
} => {
|
||||
#[test]
|
||||
fn $name() {
|
||||
let test = crate::test::Test::new();
|
||||
@ -24,6 +25,7 @@ macro_rules! test {
|
||||
$(let test = test.shell($shell);)?
|
||||
$(let test = test.status($status);)?
|
||||
$(let test = test.stderr($stderr);)?
|
||||
$(let test = test.stderr_regex($stderr_regex);)?
|
||||
$(let test = test.stdin($stdin);)?
|
||||
$(let test = test.stdout($stdout);)?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user