Skip to content

tests: regression coverage for >&file redirect-both - #315

Merged
brianjfox merged 1 commit into
mainfrom
test/redirect-both-ampfile
Jul 26, 2026
Merged

tests: regression coverage for >&file redirect-both#315
brianjfox merged 1 commit into
mainfrom
test/redirect-both-ampfile

Conversation

@brianjfox

Copy link
Copy Markdown
Owner

Follow-up to #314 / #313. Adds the negative-space test coverage that was missing when the regression was introduced.

New run_diff corpus entries (differential vs real bash):

  • { echo out; echo err >&2; } >&file; cat file — proves the bare >&file form sends both streams to the file (the actual regression guard: this case fails against the pre-Fix >&file redirect-both regression (ambiguous redirect on /dev/null) #314 build).
  • echo discarded >&/dev/null; echo kept — discard case.
  • echo hi 2>&/dev/null / cat <&/dev/null — explicit-fd and input dups with a non-fd word stay ambiguous redirects, matching bash.

Verified the file-capture test fails on the buggy build (with the redirect-both branch neutered) and passes once restored, so it genuinely guards the behavior. run_diff now covers 238 scripts; ctest 22/22.

Add differential-vs-bash regression tests for the redirection forms
around #313: a bare `>&file' sends both stdout and stderr to the file
(verified by cat'ing it back), `>&/dev/null' discards output, and the
explicit-fd `2>&file' and input `<&file' forms remain ambiguous
redirects.  The file-capture case fails against the pre-#314 build,
guarding the regression that the batch95 ambiguous-redirect check
introduced.
@brianjfox
brianjfox merged commit 865fa8f into main Jul 26, 2026
1 check passed
@brianjfox
brianjfox deleted the test/redirect-both-ampfile branch July 26, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant