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:
Andrej Kolchin 2023-12-15 06:53:19 +00:00 committed by GitHub
parent 5b01685fc3
commit 78f52e8b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -927,9 +927,9 @@ mod test {
#[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);
assert_eq!("bash -c 'echo a'", res)
assert_eq!("sh -c 'echo a'", res)
}
}

View File

@ -122,27 +122,24 @@ fn capture_error_with_both_stdout_stderr_messages_not_hang_nushell() {
"external with many stdout and stderr messages",
|dirs, sandbox| {
let script_body = r#"
x=$(printf '=%.0s' {1..40960})
x=$(printf '=%.0s' $(seq 40960))
echo $x
echo $x 1>&2
"#;
let mut expect_body = String::new();
for _ in 0..40960 {
expect_body.push('=');
}
let expect_body = "=".repeat(40960);
sandbox.with_files(vec![FileWithContent("test.sh", script_body)]);
// check for stdout
let actual = nu!(
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);
// check for stderr
let actual = nu!(
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);
},