From 5d43113a78f40984e784181024438a6a792b057a Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Wed, 16 Sep 2026 16:27:44 -0500 Subject: [PATCH] Add test coverage for order-sensitive ON_ERROR_STOP check Add tests/updates for pgxntool commit https://github.com/Postgres-Extensions/pgxntool/pull/122 (order-sensitive ON_ERROR_STOP detection in check-test-install-error-stop.sh): - Bare substring grep passed a file that only ever turned ON_ERROR_STOP off; the script now requires an explicit on-value seen in file order. Extend the existing script-logic bats file with the two new cases that distinguish this from the old bare-substring behavior: - on-then-off still passes (a later off doesn't undo an earlier on) - off-only (never explicitly on) fails Co-Authored-By: Claude Sonnet 5 --- .../check-test-install-error-stop-script.bats | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/standard/check-test-install-error-stop-script.bats b/test/standard/check-test-install-error-stop-script.bats index be5f8a9..4f1a22b 100644 --- a/test/standard/check-test-install-error-stop-script.bats +++ b/test/standard/check-test-install-error-stop-script.bats @@ -42,6 +42,22 @@ setup() { assert_success } +@test "check-test-install-error-stop.sh: passes when ON_ERROR_STOP is explicitly turned on then off" { + printf '\\set ON_ERROR_STOP on\nCREATE TABLE foo AS SELECT 1;\n\\set ON_ERROR_STOP off\n' > "$TESTDIR/install/foo.sql" + + run "$SCRIPT" "$TESTDIR" + assert_success +} + +@test "check-test-install-error-stop.sh: fails when ON_ERROR_STOP is only ever turned off" { + printf '\\set ON_ERROR_STOP off\nCREATE TABLE foo AS SELECT 1;\n' > "$TESTDIR/install/foo.sql" + + run "$SCRIPT" "$TESTDIR" + assert_failure_with_status 1 + assert_contains "$output" "foo.sql" + assert_contains "$output" "ON_ERROR_STOP" +} + @test "check-test-install-error-stop.sh: fails when a file has neither" { printf 'CREATE TABLE foo AS SELECT 1;\n' > "$TESTDIR/install/foo.sql"