diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-01-15 11:36:02 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-01-16 09:18:20 -0800 |
| commit | 6807d3942c6104b32f6c7e04c1f7b5d2c82afa30 (patch) | |
| tree | 7bd0c8a8b34adfb032b13f1e6a9175d53dde877a | |
| parent | completion: discover repo path in `__git_pseudoref_exists ()` (diff) | |
| download | git-6807d3942c6104b32f6c7e04c1f7b5d2c82afa30.tar.gz git-6807d3942c6104b32f6c7e04c1f7b5d2c82afa30.zip | |
t9902: verify that completion does not print anything
The Bash completion script must not print anything to either stdout or
stderr. Instead, it is only expected to populate certain variables.
Tighten our `test_completion ()` test helper to verify this requirement.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rwxr-xr-x | t/t9902-completion.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index aa9a614de3..95ec762a74 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -5,6 +5,12 @@ test_description='test bash completion' +# The Bash completion scripts must not print anything to either stdout or +# stderr, which we try to verify. When tracing is enabled without support for +# BASH_XTRACEFD this assertion will fail, so we have to mark the test as +# untraceable with such ancient Bash versions. +test_untraceable=UnfortunatelyYes + . ./lib-bash.sh complete () @@ -87,9 +93,11 @@ test_completion () else sed -e 's/Z$//' |sort >expected fi && - run_completion "$1" && + run_completion "$1" >"$TRASH_DIRECTORY"/bash-completion-output 2>&1 && sort out >out_sorted && - test_cmp expected out_sorted + test_cmp expected out_sorted && + test_must_be_empty "$TRASH_DIRECTORY"/bash-completion-output && + rm "$TRASH_DIRECTORY"/bash-completion-output } # Test __gitcomp. |
