gbranden pushed a commit to branch master
in repository groff.

commit 55d6077463806294bd7e38c633f438a90c02a9a5
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Wed Mar 5 05:36:15 2025 -0600

    [troff]: Unit-test `.devicem` and `\Y`.
    
    * src/roff/groff/tests/backslash-Y-works.sh:
    * src/roff/groff/tests/devicem-request-works.sh: Do it.
    * src/roff/groff/groff.am (groff_TESTS): Run tests.
---
 ChangeLog                                     |  9 ++++++
 src/roff/groff/groff.am                       |  2 ++
 src/roff/groff/tests/backslash-Y-works.sh     | 40 +++++++++++++++++++++++++++
 src/roff/groff/tests/devicem-request-works.sh | 40 +++++++++++++++++++++++++++
 4 files changed, 91 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 2f0a2e8af..58cc300cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-03-05  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       [troff]: Add unit tests for `devicem` request and `\Y` escape
+       sequence.
+
+       * src/roff/groff/tests/backslash-Y-works.sh:
+       * src/roff/groff/tests/devicem-request-works.sh: Do it.
+       * src/roff/groff/groff.am (groff_TESTS): Run tests.
+
 2025-03-02  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/roff/troff/mtsm.cpp (statem::display_state):
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 722d22a7f..15c752e3d 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -40,6 +40,7 @@ groff_TESTS = \
   src/roff/groff/tests/adjustment-works.sh \
   src/roff/groff/tests/arithmetic-works.sh \
   src/roff/groff/tests/backslash-X-works.sh \
+  src/roff/groff/tests/backslash-Y-works.sh \
   src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh \
   src/roff/groff/tests/backslash-s-works-with-single-digit-argument.sh \
   src/roff/groff/tests/break-zero-length-output-line-sanely.sh \
@@ -53,6 +54,7 @@ groff_TESTS = \
   src/roff/groff/tests/device-control-special-character-handling.sh \
   src/roff/groff/tests/device-request-passes-most-escape-sequences.sh \
   src/roff/groff/tests/device-request-works.sh \
+  src/roff/groff/tests/devicem-request-works.sh \
   src/roff/groff/tests/do-not-loop-infinitely-when-breaking-cjk.sh \
   src/roff/groff/tests/dot-cp-register-works.sh \
   src/roff/groff/tests/dot-nm-register-works.sh \
diff --git a/src/roff/groff/tests/backslash-Y-works.sh 
b/src/roff/groff/tests/backslash-Y-works.sh
new file mode 100755
index 000000000..697b8e4f3
--- /dev/null
+++ b/src/roff/groff/tests/backslash-Y-works.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# 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"
+
+input='.
+.de mac
+This
+is
+a
+macro.
+..
+hello
+\Y[mac]
+.'
+
+output=$(printf "%s\n" "$input" | "$groff" -T ps -Z)
+echo "$output"
+
+oneline=$(echo "$output" | tr '\n' ' ')
+echo "$oneline" | grep -Fq ' x X This +is +a +macro. + '
+
+# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
diff --git a/src/roff/groff/tests/devicem-request-works.sh 
b/src/roff/groff/tests/devicem-request-works.sh
new file mode 100755
index 000000000..f82465ca7
--- /dev/null
+++ b/src/roff/groff/tests/devicem-request-works.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# 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"
+
+input='.
+.de mac
+This
+is
+a
+macro.
+..
+hello
+.devicem mac
+.'
+
+output=$(printf "%s\n" "$input" | "$groff" -T ps -Z)
+echo "$output"
+
+oneline=$(echo "$output" | tr '\n' ' ')
+echo "$oneline" | grep -Fq ' x X This +is +a +macro. + '
+
+# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to