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