gbranden pushed a commit to branch master
in repository groff.

commit 527d10a6ff340d72eac1d05b723a7e9af84f7329
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jun 19 01:24:38 2026 -0500

    [refer]: Add smoke test.
    
    * src/preproc/refer/tests/artifacts/little-schemer.bib: Add.
    * src/preproc/refer/tests/smoke-test.sh: Add.
    * src/preproc/refer/refer.am (refer_TESTS): Run test.
      (EXTRA_DIST): Ship new artifact.
---
 ChangeLog                                          |  9 ++++
 src/preproc/refer/refer.am                         |  6 ++-
 .../refer/tests/artifacts/little-schemer.bib       |  6 +++
 src/preproc/refer/tests/smoke-test.sh              | 60 ++++++++++++++++++++++
 4 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8da72abab..08751693e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,15 @@
        Unconditionally memset(3) the memory from the end of the new
        string to the end of string's capacity.
 
+2026-06-19  G. Branden Robinson <[email protected]>
+
+       [refer]: Add smoke test.
+
+       * src/preproc/refer/tests/artifacts/little-schemer.bib: Add.
+       * src/preproc/refer/tests/smoke-test.sh: Add.
+       * src/preproc/refer/refer.am (refer_TESTS): Run test.
+       (EXTRA_DIST): Ship new artifact.
+
 2026-06-19  G. Branden Robinson <[email protected]>
 
        * src/libs/libgroff/string.cpp (string::string): Drop redundant
diff --git a/src/preproc/refer/refer.am b/src/preproc/refer/refer.am
index fd19defba..6a5028a9e 100644
--- a/src/preproc/refer/refer.am
+++ b/src/preproc/refer/refer.am
@@ -59,11 +59,13 @@ maintainer-clean-refer:
        fi
 
 refer_TESTS = \
-  src/preproc/refer/tests/report-correct-line-numbers.sh
+  src/preproc/refer/tests/report-correct-line-numbers.sh \
+  src/preproc/refer/tests/smoke-test.sh
 TESTS += $(refer_TESTS)
 EXTRA_DIST += \
   $(refer_TESTS) \
-  src/preproc/refer/tests/artifacts/62124.bib
+  src/preproc/refer/tests/artifacts/62124.bib \
+  src/preproc/refer/tests/artifacts/little-schemer.bib
 
 uninstall_groffdirs: uninstall_refer_hook
 uninstall_refer_hook:
diff --git a/src/preproc/refer/tests/artifacts/little-schemer.bib 
b/src/preproc/refer/tests/artifacts/little-schemer.bib
new file mode 100644
index 000000000..5d9671a27
--- /dev/null
+++ b/src/preproc/refer/tests/artifacts/little-schemer.bib
@@ -0,0 +1,6 @@
+%A Daniel P.\& Friedman
+%A Matthias Felleisen
+%C Cambridge, Massachusetts
+%D 1996
+%I The MIT Press
+%T The Little Schemer, Fourth Edition
diff --git a/src/preproc/refer/tests/smoke-test.sh 
b/src/preproc/refer/tests/smoke-test.sh
new file mode 100755
index 000000000..d5ba87629
--- /dev/null
+++ b/src/preproc/refer/tests/smoke-test.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Copyright 2026 Free Software Foundation, Inc.
+#
+# This file is part of groff, the GNU roff typesetting system.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+refer="${abs_top_builddir:-.}/refer"
+
+# Test basic refer(1) functionality.
+
+# Locate directory containing our test artifacts.
+artifact_dir=
+
+for buildroot in . .. ../..
+do
+    d=$buildroot/src/preproc/refer/tests/artifacts
+    if [ -d "$d" ]
+    then
+        artifact_dir=$d
+        break
+    fi
+done
+
+# If we can't find it, we can't test.
+test -z "$artifact_dir" && exit 77 # skip
+
+input='.
+.LP
+Read the book
+.[
+friedman
+.]
+on your summer vacation.
+Commentary is available.\*{*\*}
+.FS \*{*\*}
+Space reserved for penetrating insight.
+.FE
+.'
+
+output=$(printf '%s\n' "$input" \
+    | REFER="$artifact_dir"/little-schemer.bib "$refer")
+
+echo "$output"
+echo "$output" | grep -Fqx 'Read the book\*([.1\*(.]'
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to