groff-commit
[Top][All Lists]
Advanced

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

[groff] 13/20: [man]: Add unit tests for `MT/ME` and `UR/UE`.


From: G. Branden Robinson
Subject: [groff] 13/20: [man]: Add unit tests for `MT/ME` and `UR/UE`.
Date: Thu, 24 Nov 2022 22:11:34 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 96502dc30f10de36919f8f88cd447405cf7f1309
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Nov 22 23:52:20 2022 -0600

    [man]: Add unit tests for `MT/ME` and `UR/UE`.
    
    * tmac/tests/an-ext_MT-works.sh:
    * tmac/tests/an-ext_UR-works.sh: Do it.
    
    * tmac/tmac.am (tmac_TESTS): Run tests.
---
 ChangeLog                     |  9 ++++++
 tmac/tests/an-ext_MT-works.sh | 67 +++++++++++++++++++++++++++++++++++++++++
 tmac/tests/an-ext_UR-works.sh | 69 +++++++++++++++++++++++++++++++++++++++++++
 tmac/tmac.am                  |  2 ++
 4 files changed, 147 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 40c03212d..aec17d7eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-11-22  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [man]: Add unit tests for `MT/ME` and `UR/UE`.
+
+       * tmac/tests/an-ext_MT-works.sh:
+       * tmac/tests/an-ext_UR-works.sh: Do it.
+
+       * tmac/tmac.am (tmac_TESTS): Run tests.
+
 2022-11-18  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/gropdf/gropdf.pl: Throw warning if paper format is
diff --git a/tmac/tests/an-ext_MT-works.sh b/tmac/tests/an-ext_MT-works.sh
new file mode 100755
index 000000000..198a8ac48
--- /dev/null
+++ b/tmac/tests/an-ext_MT-works.sh
@@ -0,0 +1,67 @@
+#!/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
+}
+
+input='.TH foo 1 2022-11-22 "groff test suite"
+.SH Name
+foo \- frobnicate a bar
+.SH Description
+Mail
+.MT modok@\:example\:.com
+the boss
+.ME .
+.
+Complaints to
+.MT nobody@\:example\:.com
+.ME .'
+
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man -rU0)
+echo "$output"
+
+echo "checking formatting of mail URI with link text" \
+    "(hyperlinks disabled)" >&2
+echo "$output" | grep -Fq 'Mail the boss <modok@example.com>.' || wail
+
+echo "checking formatting of mail URI with no link text" \
+    "(hyperlinks disabled)" >&2
+echo "$output" | grep -Fq 'Complaints to <nobody@example.com>.' || wail
+
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man -rU1)
+echo "$output"
+
+echo "checking formatting of mail URI with link text" \
+    "(hyperlinks enabled)" >&2
+echo "$output" | grep -Fq 'Mail the boss.' || wail
+
+echo "checking formatting of mail URI with no link text" \
+    "(hyperlinks enabled)" >&2
+echo "$output" | grep -Fq 'Complaints to nobody@example.com.' || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tests/an-ext_UR-works.sh b/tmac/tests/an-ext_UR-works.sh
new file mode 100755
index 000000000..074225817
--- /dev/null
+++ b/tmac/tests/an-ext_UR-works.sh
@@ -0,0 +1,69 @@
+#!/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
+}
+
+input='.TH foo 1 2022-11-22 "groff test suite"
+.SH Name
+foo \- frobnicate a bar
+.SH Description
+See
+.UR http://\:foo\:.example\:.com
+figure 1
+.UE .
+.
+Or
+.UR http://\:bar\:.example\:.com
+.UE .'
+
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man -rU0)
+echo "$output"
+
+echo "checking formatting of web URI with link text" \
+    "(hyperlinks disabled)" >&2
+echo "$output" | grep -Fq 'See figure 1 <http://foo.example.com>.' \
+    || wail
+
+
+echo "checking formatting of web URI with no link text" \
+    "(hyperlinks disabled)" >&2
+echo "$output" | grep -Fq 'Or <http://bar.example.com>.' || wail
+
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man -rU1)
+echo "$output"
+
+echo "checking formatting of web URI with link text" \
+    "(hyperlinks enabled)" >&2
+echo "$output" | grep -Fq 'See figure 1.' || wail
+
+echo "checking formatting of web URI with no link text" \
+    "(hyperlinks enabled)" >&2
+echo "$output" | grep -Fq 'Or http://bar.example.com.' || 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 e37c55380..7c0a018b6 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -147,9 +147,11 @@ EXTRA_DIST += \
 tmac_TESTS = \
   tmac/tests/an-ext_ME-punct-hyphenates.sh \
   tmac/tests/an-ext_MT-body-hyphenates.sh \
+  tmac/tests/an-ext_MT-works.sh \
   tmac/tests/an-ext_UE-breaks-before-long-URIs.sh \
   tmac/tests/an-ext_UE-punct-hyphenates.sh \
   tmac/tests/an-ext_UR-body-hyphenates.sh \
+  tmac/tests/an-ext_UR-works.sh \
   tmac/tests/an-ext_link-macros-work-in-paragraph-tags.sh \
   tmac/tests/an_AT-and-UC-footer-saved-and-restored.sh \
   tmac/tests/an_CS-register-off.sh \



reply via email to

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