forked from extern/nushell
Replace bash with POSIX sh in tests (#11293)
Just my small pet peeve. This allows to run tests without bash installed. There were only two minor tests which required a change.
This commit is contained in:
parent
5b01685fc3
commit
78f52e8b66
@ -927,9 +927,9 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn argument_with_inner_quotes_test() {
|
fn argument_with_inner_quotes_test() {
|
||||||
let input = r#"bash -c 'echo a'"#.into();
|
let input = r#"sh -c 'echo a'"#.into();
|
||||||
let res = remove_quotes(input);
|
let res = remove_quotes(input);
|
||||||
|
|
||||||
assert_eq!("bash -c 'echo a'", res)
|
assert_eq!("sh -c 'echo a'", res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,27 +122,24 @@ fn capture_error_with_both_stdout_stderr_messages_not_hang_nushell() {
|
|||||||
"external with many stdout and stderr messages",
|
"external with many stdout and stderr messages",
|
||||||
|dirs, sandbox| {
|
|dirs, sandbox| {
|
||||||
let script_body = r#"
|
let script_body = r#"
|
||||||
x=$(printf '=%.0s' {1..40960})
|
x=$(printf '=%.0s' $(seq 40960))
|
||||||
echo $x
|
echo $x
|
||||||
echo $x 1>&2
|
echo $x 1>&2
|
||||||
"#;
|
"#;
|
||||||
let mut expect_body = String::new();
|
let expect_body = "=".repeat(40960);
|
||||||
for _ in 0..40960 {
|
|
||||||
expect_body.push('=');
|
|
||||||
}
|
|
||||||
|
|
||||||
sandbox.with_files(vec![FileWithContent("test.sh", script_body)]);
|
sandbox.with_files(vec![FileWithContent("test.sh", script_body)]);
|
||||||
|
|
||||||
// check for stdout
|
// check for stdout
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
"do -c {bash test.sh} | complete | get stdout | str trim",
|
"do -c {sh test.sh} | complete | get stdout | str trim",
|
||||||
));
|
));
|
||||||
assert_eq!(actual.out, expect_body);
|
assert_eq!(actual.out, expect_body);
|
||||||
// check for stderr
|
// check for stderr
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), pipeline(
|
cwd: dirs.test(), pipeline(
|
||||||
"do -c {bash test.sh} | complete | get stderr | str trim",
|
"do -c {sh test.sh} | complete | get stderr | str trim",
|
||||||
));
|
));
|
||||||
assert_eq!(actual.out, expect_body);
|
assert_eq!(actual.out, expect_body);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user