[PATCH 1/2] t9902: verify that completion does not print anything
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 11, 2024, 10:41 UTC
- Message-ID
- <73406ca9c8f38ac2ad8f0e32d6d81f1566a6b4d1.1704969119.git.ps@pks.im>
- In-Reply-To
- <cover.1704969119.git.ps@pks.im>
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> --- t/t9902-completion.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index aa9a614de3..78cb93bea7 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -87,9 +87,11 @@ test_completion () else sed -e 's/Z$//' |sort >expected fi && - run_completion "$1" && + run_completion "$1" >"$TRASH_DIRECTORY"/output 2>&1 && sort out >out_sorted && - test_cmp expected out_sorted + test_cmp expected out_sorted && + test_must_be_empty "$TRASH_DIRECTORY"/output && + rm "$TRASH_DIRECTORY"/output } # Test __gitcomp.
-- 2.43.GIT