mirror of
https://github.com/nushell/nushell.git
synced 2024-11-07 09:04:18 +01:00
change display_error.exit_code to false (#13873)
The idea comes from @amtoine, I think it would be good to keey `display_error.exit_code` same value, if user is using default config or using no config file at all.
This commit is contained in:
parent
a0f38f8845
commit
639bd4fc2e
@ -9,25 +9,28 @@ fn capture_errors_works() {
|
||||
assert!(actual.err.contains("column_not_found"));
|
||||
}
|
||||
|
||||
// TODO: need to add tests under display_error.exit_code = true
|
||||
#[test]
|
||||
fn capture_errors_works_for_external() {
|
||||
let actual = nu!("do -c {nu --testbin fail}");
|
||||
assert!(actual.err.contains("exited with code"));
|
||||
assert_eq!(actual.out, "");
|
||||
assert!(!actual.status.success());
|
||||
assert!(!actual.err.contains("exited with code"));
|
||||
}
|
||||
|
||||
// TODO: need to add tests under display_error.exit_code = true
|
||||
#[test]
|
||||
fn capture_errors_works_for_external_with_pipeline() {
|
||||
let actual = nu!("do -c {nu --testbin fail} | echo `text`");
|
||||
assert!(actual.err.contains("exited with code"));
|
||||
assert_eq!(actual.out, "");
|
||||
assert!(!actual.status.success());
|
||||
assert!(!actual.err.contains("exited with code"));
|
||||
}
|
||||
|
||||
// TODO: need to add tests under display_error.exit_code = true
|
||||
#[test]
|
||||
fn capture_errors_works_for_external_with_semicolon() {
|
||||
let actual = nu!(r#"do -c {nu --testbin fail}; echo `text`"#);
|
||||
assert!(actual.err.contains("exited with code"));
|
||||
assert_eq!(actual.out, "");
|
||||
assert!(!actual.status.success());
|
||||
assert!(!actual.err.contains("exited with code"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -22,7 +22,7 @@ impl DisplayErrors {
|
||||
impl Default for DisplayErrors {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
exit_code: true,
|
||||
exit_code: false,
|
||||
termination_signal: true,
|
||||
}
|
||||
}
|
||||
|
@ -627,16 +627,18 @@ fn exit_code_stops_execution_closure() {
|
||||
assert!(actual.err.contains("exited with code 1"));
|
||||
}
|
||||
|
||||
// TODO: need to add tests under display_error.exit_code = true
|
||||
#[test]
|
||||
fn exit_code_stops_execution_custom_command() {
|
||||
let actual = nu!("def cmd [] { nu -c 'exit 42'; 'ok1' }; cmd; print 'ok2'");
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.contains("exited with code 42"));
|
||||
assert!(!actual.err.contains("exited with code 42"));
|
||||
}
|
||||
|
||||
// TODO: need to add tests under display_error.exit_code = true
|
||||
#[test]
|
||||
fn exit_code_stops_execution_for_loop() {
|
||||
let actual = nu!("for x in [0 1] { nu -c 'exit 42'; print $x }");
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.contains("exited with code 42"));
|
||||
assert!(!actual.err.contains("exited with code 42"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user