forked from extern/nushell
Eval external command result immediately when using do
command with -c
(#6645)
* make capture error works better in do command * remove into string test because we have no way to generate Value::Error for now
This commit is contained in:
@ -5,11 +5,47 @@ fn capture_errors_works() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
do -c {$env.use} | describe
|
||||
do -c {$env.use}
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "error");
|
||||
assert!(actual.err.contains("column_not_found"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capture_errors_works_for_external() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
do -c {nu --testbin fail}
|
||||
"#
|
||||
));
|
||||
assert!(actual.err.contains("External command runs to failed"));
|
||||
assert_eq!(actual.out, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capture_errors_works_for_external_with_pipeline() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
do -c {nu --testbin fail} | echo `text`
|
||||
"#
|
||||
));
|
||||
assert!(actual.err.contains("External command runs to failed"));
|
||||
assert_eq!(actual.out, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capture_errors_works_for_external_with_semicolon() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
do -c {nu --testbin fail}; echo `text`
|
||||
"#
|
||||
));
|
||||
assert!(actual.err.contains("External command runs to failed"));
|
||||
assert_eq!(actual.out, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -172,18 +172,6 @@ fn from_nothing() {
|
||||
assert_eq!(actual.out, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_error() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
do -c {$env.use} | into string
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "nu::shell::column_not_found");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn int_into_string() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user