gbranden pushed a commit to branch master
in repository groff.

commit 0643323649d3866c2596cdcb66fa9d8533c18984
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Oct 30 05:06:37 2025 -0500

    [grotty]: Unit-test '-h' option.
    
    * src/devices/grotty/tests/h-option-works.sh: Add unit test for function
      of grotty's '-h' option.
    
    * src/devices/grotty/grotty.am (grotty_TESTS): Run test.
---
 ChangeLog                                  |  6 +++
 src/devices/grotty/grotty.am               |  1 +
 src/devices/grotty/tests/h-option-works.sh | 77 ++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 438f58554..4322caf41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-10-30  G. Branden Robinson <[email protected]>
+
+       * src/devices/grotty/tests/h-option-works.sh: Add unit test for
+       function of grotty's '-h' option.
+       * src/devices/grotty/grotty.am (grotty_TESTS): Run test.
+
 2025-10-30  G. Branden Robinson <[email protected]>
 
        [grotty]: Rename test scripts to match modern naming convention.
diff --git a/src/devices/grotty/grotty.am b/src/devices/grotty/grotty.am
index 8122fa850..dbcda687f 100644
--- a/src/devices/grotty/grotty.am
+++ b/src/devices/grotty/grotty.am
@@ -35,6 +35,7 @@ EXTRA_DIST += \
 
 grotty_TESTS = \
   src/devices/grotty/tests/basic-latin-glyphs-map-correctly.sh \
+  src/devices/grotty/tests/h-option-works.sh \
   src/devices/grotty/tests/osc8-works.sh
 TESTS += $(grotty_TESTS)
 EXTRA_DIST += $(grotty_TESTS)
diff --git a/src/devices/grotty/tests/h-option-works.sh 
b/src/devices/grotty/tests/h-option-works.sh
new file mode 100755
index 000000000..8f679a50e
--- /dev/null
+++ b/src/devices/grotty/tests/h-option-works.sh
@@ -0,0 +1,77 @@
+#!/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/>.
+
+grotty="${abs_top_builddir:-.}/grotty"
+
+fail=
+
+wail () {
+    echo "...FAILED" >&2
+    fail=yes
+}
+
+# Ensure that characters are mapped to glyphs normatively.
+
+input='#
+x T ascii
+x res 240 24 40
+x init
+p 1
+x font 1 R
+f 1
+s 10
+V 40
+H 0
+m d
+D F d
+t 1234567890123456
+n 40 0
+V 80
+H 0
+t abcdef
+w
+h 48
+t ijklmnop
+n 40 0
+V 120
+H 0
+t abcdefg
+w
+h 24
+t ijklmnop
+n 40 0
+x trailer
+V 120
+x stop
+#'
+
+output=$(printf '%s\n' "$input" | "$grotty" -F font -F build/font -h)
+echo "$output"
+
+tab=$(printf '\t') # Some shells don't support $'\t' yet.
+
+echo "checking that tab used to move > 1 cell to next tab stop" >&2
+echo "$output" | grep -q "abcdef${tab}ijklmnop" || wail
+
+echo "checking that space used to move 1 cell to next tab stop" >&2
+echo "$output" | grep -q "abcdefg ijklmnop" || 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