diff --git a/crates/nu-test-support/src/lib.rs b/crates/nu-test-support/src/lib.rs index 37e78f8f0e..5e2ab8a44b 100644 --- a/crates/nu-test-support/src/lib.rs +++ b/crates/nu-test-support/src/lib.rs @@ -3,12 +3,15 @@ pub mod fs; pub mod locale_override; pub mod macros; pub mod playground; +use std::process::ExitStatus; + // Needs to be reexported for `nu!` macro pub use nu_path; pub struct Outcome { pub out: String, pub err: String, + pub status: ExitStatus, } #[cfg(windows)] @@ -22,8 +25,8 @@ pub const NATIVE_PATH_ENV_SEPARATOR: char = ';'; pub const NATIVE_PATH_ENV_SEPARATOR: char = ':'; impl Outcome { - pub fn new(out: String, err: String) -> Outcome { - Outcome { out, err } + pub fn new(out: String, err: String, status: ExitStatus) -> Outcome { + Outcome { out, err, status } } } diff --git a/crates/nu-test-support/src/macros.rs b/crates/nu-test-support/src/macros.rs index 8b8a418f3d..d0957355f1 100644 --- a/crates/nu-test-support/src/macros.rs +++ b/crates/nu-test-support/src/macros.rs @@ -279,7 +279,7 @@ pub fn nu_run_test(opts: NuOpts, commands: impl AsRef, with_std: bool) -> O println!("=== stderr\n{}", err); - Outcome::new(out, err.into_owned()) + Outcome::new(out, err.into_owned(), output.status) } pub fn nu_with_plugin_run_test(cwd: impl AsRef, plugins: &[&str], command: &str) -> Outcome { @@ -339,7 +339,7 @@ pub fn nu_with_plugin_run_test(cwd: impl AsRef, plugins: &[&str], command: println!("=== stderr\n{}", err); - Outcome::new(out, err.into_owned()) + Outcome::new(out, err.into_owned(), output.status) } fn escape_quote_string(input: String) -> String {