gbranden pushed a commit to branch master
in repository groff.

commit 6314ec2f0cd35b3bbe5b030c6ab66336926320a6
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Dec 5 04:26:20 2025 -0600

    [groff]: Add unit test for new `pchar` request.
    
    * src/roff/groff/tests/pchar-request-works.sh: Do it.
    
    * src/roff/groff/groff.am (groff_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                   |  7 ++++
 src/roff/groff/groff.am                     |  1 +
 src/roff/groff/tests/pchar-request-works.sh | 62 +++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 425c1f482..9dfb92c69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-12-05  G. Branden Robinson <[email protected]>
+
+       [groff]: Add unit test for new `pchar` request.
+
+       * src/roff/groff/tests/pchar-request-works.sh: Do it.
+       * src/roff/groff/groff.am (groff_TESTS): Run test.
+
 2025-12-03  G. Branden Robinson <[email protected]>
 
        [troff]: Describe character (classes) better.  Character classes
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 6d9c1e272..9fa0e319f 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -98,6 +98,7 @@ groff_TESTS = \
   src/roff/groff/tests/localization-works.sh \
   src/roff/groff/tests/msoquiet-request-works.sh \
   src/roff/groff/tests/output-request-works.sh \
+  src/roff/groff/tests/pchar-request-works.sh \
   src/roff/groff/tests/pi-request-works.sh \
   src/roff/groff/tests/ps-device-smoke-test.sh \
   src/roff/groff/tests/recognize-end-of-sentence.sh \
diff --git a/src/roff/groff/tests/pchar-request-works.sh 
b/src/roff/groff/tests/pchar-request-works.sh
new file mode 100755
index 000000000..a3cf41cc5
--- /dev/null
+++ b/src/roff/groff/tests/pchar-request-works.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Copyright 2025 G. Branden Robinson
+#
+# This file is part of groff.
+#
+# 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/>.
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+fail=
+
+wail () {
+  echo ...FAILED >&2
+  fail=YES
+}
+
+# Verify that `pchar` doesn't crash the formatter.  We have no
+# specification for its output to the standard error stream.
+
+echo "checking that 'pchar' request works on ordinary character" >&2
+output=$(printf '.pchar -\n' | "$groff" 2>&1)
+test $? -eq 0 || wail
+echo "$output"
+
+echo "checking that 'pchar' request works on special character" >&2
+output=$(printf '.pchar \\[-]\n' | "$groff" 2>&1)
+test $? -eq 0 || wail
+echo "$output"
+
+echo "checking that 'pchar' request works on indexed character" >&2
+output=$(printf '.pchar \\N"45"\n' | "$groff" 2>&1)
+test $? -eq 0 || wail
+echo "$output"
+
+echo "checking that 'pchar' request works on character class" >&2
+output=$(printf '.pchar \\C"[CJKprepunct]"\n' \
+    | "$groff" -m ja -T utf8 2>&1)
+test $? -eq 0 || wail
+echo "$output"
+
+# Regression-test a blunder made during the request's development.
+
+echo "checking that 'pchar' request handles trailing space" >&2
+output=$(printf '.pchar - \n' | "$groff" 2>&1)
+echo "$output"
+echo "$output" | grep 'error' && wail
+
+test -z "$fail"
+
+# 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