tests: regression coverage for >&file redirect-both - #315
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #314 / #313. Adds the negative-space test coverage that was missing when the regression was introduced.
New
run_diffcorpus entries (differential vs real bash):{ echo out; echo err >&2; } >&file; cat file— proves the bare>&fileform 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_diffnow covers 238 scripts;ctest22/22.