From ba62232cefd328cf8323272ee5dd3d3c44d42922 Mon Sep 17 00:00:00 2001 From: fujibee Date: Tue, 18 Aug 2026 17:29:57 -0700 Subject: [PATCH] test(compat): make the space-in-path premise able to fail `main` is red on the enforced-assertions ratchet: 639 against a baseline of 638. The count rose at fa826b7 (#771), which added [[ "$raw" == *"Application Support"* ]] as the premise for the case below it -- and a non-last `[[ ]]` cannot fail a test on bash 3.2 (#670). So the premise passed on any `raw` at all, and the assertions underneath it would have run against a value that never had the shape they are about. A premise that cannot fail is worse than no premise, because it reads as one. Uses `grep -qF`, the idiom the other #850-era cases in this tree settled on. The baseline is deliberately not bumped. The ratchet was reporting a real defect, not drift. --- tests/test_compat_posix.bats | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_compat_posix.bats b/tests/test_compat_posix.bats index be86fff0d..95a77fbfc 100644 --- a/tests/test_compat_posix.bats +++ b/tests/test_compat_posix.bats @@ -109,7 +109,11 @@ _stub_ps_printing() { esac # The real ps hands us a path with a space -- the premise of the stub above. - [[ "$raw" == *"Application Support"* ]] + # grep, not `[[ ]]`: a non-last `[[ ]]` cannot fail a test on bash 3.2 (#670), + # and a premise that cannot fail is worse than no premise -- the assertions + # below would still run, against a `raw` that never had the shape they are + # about. + grep -qF -- 'Application Support' <<<"$raw" run compat_get_comm "$_PROC_PID" [ "$status" -eq 0 ]