Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions crates/bashkit/tests/spec_cases/bash/pipes-redirects.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,66 @@ err1
err2
### end

### redirect_stderr_suppress
# Suppress stderr with 2>/dev/null
sleep abc 2>/dev/null
echo exit: $?
### expect
exit: 1
### end

### redirect_stderr_to_file_content
# Redirect stderr content to file and verify it
sleep abc 2>/tmp/sleep_err.txt
cat /tmp/sleep_err.txt
### bash_diff: bashkit sleep error lacks --help hint from coreutils
### expect
sleep: invalid time interval 'abc'
### end

### redirect_stderr_dup_to_stdout
# Redirect stderr to stdout with 2>&1
sleep abc 2>&1 | cat
### bash_diff: pipe stderr propagation differs
### expect
sleep: invalid time interval 'abc'
### end

### redirect_both_to_file_content
# Redirect both stdout and stderr to file with &>
echo hello; sleep abc
echo ---
### expect
hello
---
### end

### redirect_both_devnull
# Suppress both stdout and stderr with &>/dev/null
echo output &>/dev/null
echo done
### expect
done
### end

### redirect_stderr_append_content
# Append stderr from multiple commands
sleep abc 2>/tmp/err_multi.txt; sleep xyz 2>>/tmp/err_multi.txt; cat /tmp/err_multi.txt
### bash_diff: bashkit sleep error lacks --help hint from coreutils
### expect
sleep: invalid time interval 'abc'
sleep: invalid time interval 'xyz'
### end

### redirect_stdout_to_stderr
# Redirect stdout to stderr (>&2) then suppress stderr
echo hello >&2 2>/dev/null
echo done
### bash_diff: redirect ordering model differs
### expect
done
### end

### heredoc_single_quoted_delimiter
# Heredoc with single-quoted delimiter disables variable expansion
NAME=world; cat <<'EOF'
Expand Down
26 changes: 26 additions & 0 deletions crates/bashkit/tests/spec_cases/bash/sleep.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,29 @@ echo exit: $?
### expect
exit: 1
### end

### sleep_stderr_suppress
# Suppress sleep error message with 2>/dev/null
sleep abc 2>/dev/null
echo exit: $?
### expect
exit: 1
### end

### sleep_stderr_to_file
# Redirect sleep error message to file
sleep abc 2>/tmp/sleep_err.txt; cat /tmp/sleep_err.txt
### bash_diff: bashkit sleep error lacks --help hint from coreutils
### expect
sleep: invalid time interval 'abc'
### end

### sleep_stderr_append
# Append stderr from multiple sleep errors
sleep abc 2>/tmp/sleep_errs.txt; sleep xyz 2>>/tmp/sleep_errs.txt
cat /tmp/sleep_errs.txt
### bash_diff: bashkit sleep error lacks --help hint from coreutils
### expect
sleep: invalid time interval 'abc'
sleep: invalid time interval 'xyz'
### end
Loading