groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 15/16: [doc]: Add unit test for `X` register.


From: G. Branden Robinson
Subject: [groff] 15/16: [doc]: Add unit test for `X` register.
Date: Wed, 14 Dec 2022 21:12:16 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 01bde8101550c9c56e690fe046b0c4bedb5fb6e0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Dec 14 19:18:34 2022 -0600

    [doc]: Add unit test for `X` register.
    
    * tmac/tests/doc_X-register-works.sh: Do it.
    * tmac/tmac.am (tmac_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                          |  7 ++++
 tmac/tests/doc_X-register-works.sh | 70 ++++++++++++++++++++++++++++++++++++++
 tmac/tmac.am                       |  1 +
 3 files changed, 78 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8bdd340a9..1435bc46a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-12-15  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [doc]: Add unit test for `X` register.
+
+       * tmac/tests/doc_X-register-works.sh: Do it.
+       * tmac/tmac.am (tmac_TESTS): Run test.
+
 2022-12-15  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/doc.tmac (Nm): Fix `if` -> `ie` typo/thinko.
diff --git a/tmac/tests/doc_X-register-works.sh 
b/tmac/tests/doc_X-register-works.sh
new file mode 100755
index 000000000..d09d93b43
--- /dev/null
+++ b/tmac/tests/doc_X-register-works.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 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"
+
+fail=
+
+wail () {
+    echo ...FAILED >&2
+    fail=yes
+}
+
+# Ensure the X register takes effect on the right page and looks right.
+
+input='.Dd 2022-12-14
+.Dt foo 1
+.Os "groff foo test suite"
+.Dd 2022-12-14
+.Dt bar 1
+.Os "groff bar test suite"'
+
+output=$(printf "%s\n" "$input" \
+    | "$groff" -Tascii -P-cbou -rcR=0 -rC1 -rX1 -mdoc)
+echo "$output"
+
+echo "checking first page footer" >&2
+echo "$output" | grep -Eqx 'groff foo test suite +2022-12-14 +1' || wail
+
+echo "checking second page footer" >&2
+echo "$output" | grep -Eqx 'groff bar test suite +2022-12-14 +1a' \
+    || wail
+
+# XXX: mdoc output does not yet suppress headers and footers.
+#
+#input='.Dd 2022-12-14
+#.Dt baz 1
+#.Os "groff baz test suite"
+#.Sh Name
+#.Nm baz
+#.Nd what you will not hear at the Mos Eisley spaceport cantina
+#.Sh Description
+#This program is a fifth wheel.'
+#
+#output=$(printf "%s\n" "$input" \
+#    | "$groff" -Thtml -rcR=0 -rC1 -rX1 -mdoc)
+#echo "$output"
+#
+#echo "checking for absence of footer text in HTML output" >&2
+#echo "$OUTPUT" | grep -q 'groff baz test suite' || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tmac.am b/tmac/tmac.am
index f3c6065cb..51b9de289 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -198,6 +198,7 @@ tmac_TESTS = \
   tmac/tests/doc_Mt-works.sh \
   tmac/tests/doc_Nm-works.sh \
   tmac/tests/doc_P-register-works.sh \
+  tmac/tests/doc_X-register-works.sh \
   tmac/tests/doc_accept-mixed-case-section-headings.sh \
   tmac/tests/doc_do-not-loop-infinitely-when-shortening-headers.sh \
   tmac/tests/doc_indents-correctly.sh \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]