From 629cd30a5923793d36667851525865f62e2dad2e Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Wed, 7 Oct 2026 16:30:46 -0500 Subject: [PATCH] Test PGXNTOOL_VERIFY_RESULTS_MODE validation Add tests for pgxntool commit 7a7e9fb (https://github.com/Postgres-Extensions/pgxntool/pull/132), which validates `PGXNTOOL_VERIFY_RESULTS_MODE`: - Accepts `pgtap`/`diffs` case-insensitively - Rejects anything else, including empty, with a parse-time error New `make-test.bats` cases: - Default and mixed-case values normalize correctly via `print-` - Invalid, multi-word and empty values fail with the expected message - Mixed-case values select the matching `verify-results` recipe (`make -n`) Co-Authored-By: Claude Opus 5.5 --- test/standard/make-test.bats | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/standard/make-test.bats b/test/standard/make-test.bats index f6798a2..8116936 100755 --- a/test/standard/make-test.bats +++ b/test/standard/make-test.bats @@ -20,6 +20,7 @@ # - verify-results blocks `make results` when tests are failing, lets a # brand-new test's first expected output through (issue #119), and can be # disabled. Its own pass/fail logic lives in verify-results-pgtap-script.bats +# - PGXNTOOL_VERIFY_RESULTS_MODE is validated (pgtap/diffs, case-insensitive) load ../lib/helpers @@ -647,6 +648,43 @@ EOF assert_not_contains "$output" "Cannot run 'make results'" } +@test "PGXNTOOL_VERIFY_RESULTS_MODE accepts pgtap/diffs case-insensitively" { + run make print-PGXNTOOL_VERIFY_RESULTS_MODE + assert_success + assert_contains "$output" 'set to "pgtap"' + + local value expected + for value in pgtap pgTap PGTAP diffs Diffs DIFFS; do + expected=$(echo "$value" | tr '[:upper:]' '[:lower:]') + run make print-PGXNTOOL_VERIFY_RESULTS_MODE "PGXNTOOL_VERIFY_RESULTS_MODE=$value" + assert_success + assert_contains "$output" "set to \"$expected\"" + done +} + +@test "PGXNTOOL_VERIFY_RESULTS_MODE rejects invalid values" { + local value + for value in bogus pgtapp "pgtap diffs" ""; do + run make print-PGXNTOOL_VERIFY_RESULTS_MODE "PGXNTOOL_VERIFY_RESULTS_MODE=$value" + assert_failure + assert_contains "$output" "PGXNTOOL_VERIFY_RESULTS_MODE must be one of: pgtap diffs; got \"$value\"" + done +} + +@test "mixed-case PGXNTOOL_VERIFY_RESULTS_MODE selects the matching verify-results recipe" { + # The pgtap recipe invokes verify-results-pgtap.sh; the diffs recipe is an + # inline regression.diffs check carrying the block message. + run make -n verify-results PGXNTOOL_VERIFY_RESULTS_MODE=pgTap 2>&1 + assert_success + assert_contains "$output" "verify-results-pgtap.sh" + assert_not_contains "$output" "Cannot run 'make results'" + + run make -n verify-results PGXNTOOL_VERIFY_RESULTS_MODE=DIFFS 2>&1 + assert_success + assert_contains "$output" "Cannot run 'make results'" + assert_not_contains "$output" "verify-results-pgtap.sh" +} + @test "make results updates expected output" { skip_if_no_postgres