Skip to content

Commit 521ed75

Browse files
committed
fix
1 parent 122b567 commit 521ed75

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

tests/integration_test.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,15 +1870,14 @@ async fn shopt_failglob() {
18701870
#[tokio::test]
18711871
async fn shopt_globstar() {
18721872
// globstar on by default: ** matches zero or more directories
1873+
// use cat to verify all files are matched (content order verifies glob worked)
18731874
TestBuilder::new()
18741875
.directory("sub/deep")
18751876
.file("a.txt", "a\n")
18761877
.file("sub/b.txt", "b\n")
18771878
.file("sub/deep/c.txt", "c\n")
1878-
.command("echo **/*.txt | tr ' ' '\\n' | sort")
1879-
.assert_stdout(&format!(
1880-
"a.txt\nsub{FOLDER_SEPERATOR}b.txt\nsub{FOLDER_SEPERATOR}deep{FOLDER_SEPERATOR}c.txt\n"
1881-
))
1879+
.command("cat **/*.txt")
1880+
.assert_stdout("a\nb\nc\n")
18821881
.assert_exit_code(0)
18831882
.run()
18841883
.await;
@@ -1900,8 +1899,8 @@ async fn shopt_globstar() {
19001899
.file("a.txt", "a\n")
19011900
.file("sub/b.txt", "b\n")
19021901
.file("sub/deep/c.txt", "c\n")
1903-
.command("shopt -u globstar && echo **/*.txt")
1904-
.assert_stdout(&format!("sub{FOLDER_SEPERATOR}b.txt\n")) // only matches one level deep
1902+
.command("shopt -u globstar && cat **/*.txt")
1903+
.assert_stdout("b\n") // only matches one level deep (sub/b.txt)
19051904
.assert_exit_code(0)
19061905
.run()
19071906
.await;
@@ -1912,10 +1911,8 @@ async fn shopt_globstar() {
19121911
.file("a.txt", "a\n")
19131912
.file("sub/b.txt", "b\n")
19141913
.file("sub/deep/c.txt", "c\n")
1915-
.command("shopt -u globstar && shopt -s globstar && echo **/*.txt | tr ' ' '\\n' | sort")
1916-
.assert_stdout(&format!(
1917-
"a.txt\nsub{FOLDER_SEPERATOR}b.txt\nsub{FOLDER_SEPERATOR}deep{FOLDER_SEPERATOR}c.txt\n"
1918-
))
1914+
.command("shopt -u globstar && shopt -s globstar && cat **/*.txt")
1915+
.assert_stdout("a\nb\nc\n")
19191916
.assert_exit_code(0)
19201917
.run()
19211918
.await;
@@ -1925,21 +1922,21 @@ async fn shopt_globstar() {
19251922
async fn pipefail_option() {
19261923
// Without pipefail: exit code is from last command (0)
19271924
TestBuilder::new()
1928-
.command("sh -c 'exit 1' | true")
1925+
.command("(exit 1) | true")
19291926
.assert_exit_code(0)
19301927
.run()
19311928
.await;
19321929

19331930
// With pipefail: exit code is rightmost non-zero (1)
19341931
TestBuilder::new()
1935-
.command("set -o pipefail && sh -c 'exit 1' | true")
1932+
.command("set -o pipefail && (exit 1) | true")
19361933
.assert_exit_code(1)
19371934
.run()
19381935
.await;
19391936

19401937
// Multiple failures - should return rightmost non-zero
19411938
TestBuilder::new()
1942-
.command("set -o pipefail && sh -c 'exit 2' | sh -c 'exit 3' | true")
1939+
.command("set -o pipefail && (exit 2) | (exit 3) | true")
19431940
.assert_exit_code(3)
19441941
.run()
19451942
.await;
@@ -1953,7 +1950,7 @@ async fn pipefail_option() {
19531950

19541951
// Disable pipefail with +o
19551952
TestBuilder::new()
1956-
.command("set -o pipefail && set +o pipefail && sh -c 'exit 1' | true")
1953+
.command("set -o pipefail && set +o pipefail && (exit 1) | true")
19571954
.assert_exit_code(0)
19581955
.run()
19591956
.await;

0 commit comments

Comments
 (0)