From 9d38b41cb5a4ab0784d6cffc1b4a341526f20f6e Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Thu, 30 Jul 2026 16:15:18 -0500 Subject: [PATCH] Add test coverage for DATA wildcard fix (issue #48) Add tests/updates for pgxntool commit e7539f3 (brief description): - Widen base.mk's DATA wildcard from sql/*--*--*.sql to sql/*--*.sql so historical full-install version scripts (one `--`) get installed, not just upgrade scripts (two `--`) - Wrap in $(sort ...) to dedupe the current-version file, which the wider wildcard now also matches Add "DATA includes historical single-version sql files (issue #48)" to test/standard/base-mk-misc.bats. Runs `make print-DATA` against the template's existing historical version file (sql/pgxntool-test--0.1.0.sql) and asserts it's listed -- no scratch fixture needed since the template already carries this file. Verified the test fails against the old two-`--`-only wildcard and passes with the fix. Co-Authored-By: Claude --- test/standard/base-mk-misc.bats | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/standard/base-mk-misc.bats b/test/standard/base-mk-misc.bats index d176a41..2273fe6 100644 --- a/test/standard/base-mk-misc.bats +++ b/test/standard/base-mk-misc.bats @@ -23,6 +23,15 @@ # wired to it inside a real embedded pgxntool copy, and (CRITICAL -- see # comment below) that it matches the actual, unmodified pgxntool checkout # this test suite is running against. +# - DATA includes historical single-version sql files (issue #48): the +# template already carries sql/pgxntool-test--0.1.0.sql, a manually-written +# historical full-install script with only one `--` separator (as opposed +# to an upgrade script like ext--a--b.sql, which has two). `make +# print-DATA` must list it -- PGXS only installs files named in DATA, so a +# wildcard that requires two `--` separators silently drops these files +# from `make install`, breaking `CREATE EXTENSION ext VERSION '0.9.6'` even +# though the file is tracked in git. No scratch fixture needed: the +# template's existing historical file already reproduces this. load ../lib/helpers @@ -61,6 +70,18 @@ EOF rm -f double-include-module.mk double-include-test.mk } +@test "DATA includes historical single-version sql files (issue #48)" { + # sql/pgxntool-test--0.1.0.sql is a template-provided historical + # full-install script (one `--` separator), distinct from the + # auto-generated current-version file and from upgrade scripts like + # sql/pgxntool-test--0.1.0--0.1.1.sql (two `--` separators). Before issue + # #48 was fixed, DATA's wildcard required two `--` separators, so this + # file was silently never installed. + run make print-DATA + assert_success + assert_contains "$output" "sql/pgxntool-test--0.1.0.sql" +} + @test "bin/version prints a stamped version number" { echo "2.1.0" > "$SCRATCH_DIR/HISTORY.asc"