groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/15: [man]: Revise and add test cases.


From: G. Branden Robinson
Subject: [groff] 04/15: [man]: Revise and add test cases.
Date: Thu, 1 Feb 2024 23:45:27 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 9ce9ef49a910700b236fbe3c839af4ca375f7d6d
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Feb 1 14:49:21 2024 -0600

    [man]: Revise and add test cases.
    
    * tmac/tests/an_MT-works.sh:
    * tmac/tests/an_adjust-link-text-correctly.sh: Add more checks to test
      cases.
    
    * tmac/tests/an_MT-works.sh: Also stop worrying about the exact
      placement of adjustment spaces in this test.
---
 ChangeLog                                   |  9 ++++++++
 tmac/tests/an_MT-works.sh                   | 18 ++++++++++++----
 tmac/tests/an_adjust-link-text-correctly.sh | 33 +++++++++++++++++++++++++++--
 3 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 49096d549..6d0250e52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-02-01  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/tests/an_MT-works.sh:
+       * tmac/tests/an_adjust-link-text-correctly.sh: Add more checks
+       to test cases.
+
+       * tmac/tests/an_MT-works.sh: Also stop worrying about the exact
+       placement of adjustment spaces in this test.
+
 2024-02-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/an.tmac: Refactor.
diff --git a/tmac/tests/an_MT-works.sh b/tmac/tests/an_MT-works.sh
index d4ebf6002..18bcea002 100755
--- a/tmac/tests/an_MT-works.sh
+++ b/tmac/tests/an_MT-works.sh
@@ -45,11 +45,13 @@ 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 "$output" | grep -Eq '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
+echo "$output" | grep -Eq 'Complaints +to +<nobody@example\.com>\.' \
+    || wail
 
 output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man -rU1)
 echo "$output"
@@ -71,14 +73,22 @@ The GNU version of
 was written by
 .MT q@\:example\:.com
 Quiller
+.ME ,
+not
+.MT r@\:example\:.com
 .ME .'
 
 output=$(printf "%s\n" "$input" | "$groff" -man -Thtml)
 echo "$output"
 
-echo "checking HTML output of mail URI" >&2
+echo "checking HTML output of mail URI with link text" >&2
+echo "$output" \
+    | grep -Fqx '<a href="mailto:q@example.com";>Quiller</a>, not' \
+    || wail
+
+echo "checking HTML output of mail URI with no link text" >&2
 echo "$output" \
-    | grep -Fqx '<a href="mailto:q@example.com";>Quiller</a>.</p>' \
+    | grep -Fqx '<a href="mailto:r@example.com";>r@example.com</a>.</p>'\
     || wail
 
 test -z "$fail"
diff --git a/tmac/tests/an_adjust-link-text-correctly.sh 
b/tmac/tests/an_adjust-link-text-correctly.sh
index 9c84db291..18233c72c 100755
--- a/tmac/tests/an_adjust-link-text-correctly.sh
+++ b/tmac/tests/an_adjust-link-text-correctly.sh
@@ -20,21 +20,50 @@
 
 groff="${abs_top_builddir:-.}/test-groff"
 
+fail=
+
+wail() {
+    echo ...FAILED >&2
+    fail=yes
+}
+
 # Ensure that link text (when the hyperlink itself is not formatted
 # because the device supports hyperlinking) uses the correct line length
 # and is adjusted.
 
+# The 'XX' provokes hyphenation interior to the line due to diversion
+# handling with certain incorrect approaches to link text handling
+# (forgetting to copy environment 0 to the diversion's environment).
 input='.TH foo 1 2022-11-08 "groff test suite"
 .SH "See also"
 .
 .UR http://\:www\:.hp\:.com/\:ctg/\:Manual/\:bpl13210\:.pdf
 .I HP PCL/PJL Reference:
-.I PCL\~5 Printer Language Technical Reference Manual,
+.I PCL\~5XX Printer Language Technical Reference Manual,
 .I Part I
 .UE'
 
+echo "checking formatting of whole-line link text" >&2
 output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man -rU1)
 echo "$output"
-echo "$output" | grep -q 'HP  PCL/PJL  Reference:.*Reference Manual'
+echo "$output" | grep -q 'HP  PCL/PJL Reference: PCL 5XX.*,$' || wail
+
+input='.TH foo 1 2022-11-08 "groff test suite"
+.SH "See also"
+.
+Consult
+.UR http://\:www\:.hp\:.com/\:ctg/\:Manual/\:bpl13210\:.pdf
+.I HP PCL/PJL Reference:
+.I PCL\~5 Printer Language Technical Reference Manual,
+.I Part I
+.UE .'
+
+echo "checking formatting of partial-line link text" >&2
+output=$(printf "%s\n" "$input" | "$groff" -Tascii -P-cbou -man -rU1)
+echo "$output"
+# 2 spaces each
+echo "$output" | grep -q 'Consult HP  PCL/PJL  Reference:  PCL' || wail
+
+test -z "$fail"
 
 # vim:set ai et sw=4 ts=4 tw=72:



reply via email to

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