groff-commit
[Top][All Lists]
Advanced

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

[groff] 10/33: [andoc]: Improve test sensitivity.


From: G. Branden Robinson
Subject: [groff] 10/33: [andoc]: Improve test sensitivity.
Date: Wed, 22 Mar 2023 22:11:44 -0400 (EDT)

gbranden pushed a commit to branch branden-post-1.23.0
in repository groff.

commit 7e92240eb16b01787b876b16657f42e1f810d6ce
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Mar 22 18:19:45 2023 -0500

    [andoc]: Improve test sensitivity.
    
    Also migrate to more recent test conventions, emitting the formatted
    output and updating the style of shell usage.
---
 tmac/tests/andoc_clear-doc-traps.sh | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/tmac/tests/andoc_clear-doc-traps.sh 
b/tmac/tests/andoc_clear-doc-traps.sh
index 9a754e631..ef0e8a579 100755
--- a/tmac/tests/andoc_clear-doc-traps.sh
+++ b/tmac/tests/andoc_clear-doc-traps.sh
@@ -20,13 +20,22 @@
 
 groff="${abs_top_builddir:-.}/test-groff"
 
+fail=
+
+wail () {
+    echo ...FAILED >&2
+    fail=YES
+}
+
 # Regression-test Savannah #59246.
 #
 # andoc should remove mdoc(7) traps before rendering a man(7) page.
 # Continuous rendering has to be _off_ to catch this.
+#
+# We also deliberately omit a fourth argument to the man(7) TH call to
+# sniff out a stale footer component from mdoc(7).
 
-EXAMPLE=\
-'.Dd October 11, 2020
+input='.Dd October 11, 2020
 .Dt mdoc\-test 7
 .Os
 .Sh Name
@@ -34,14 +43,22 @@ EXAMPLE=\
 .Nd lay mine
 .Sh Description
 Just testing.
-.TH man\-test 7 2020-10-11
+.TH man\-test 7 2020-10-12
 .SH Name
 man-test \- drive sheep across minefield
 .SH Description
 \[lq]doc\-footer\[rq] should definitely not be sprung by this document.'
 
-! printf "%s\n" "$EXAMPLE" \
-    | "$groff" -Tascii -P-cbou -mandoc -rcR=0 \
-    | grep -E '^BSD +October 11, 2020 +3$'
+output=$(printf "%s\n" "$input" \
+    | "$groff" -Tascii -P-cbou -rC1 -rcR=0 -mandoc)
+echo "$output"
+
+echo 'checking for correct mdoc(7) footer on first document' >&2
+echo "$output" | grep -Eqx 'GNU +October 11, 2020 +1' || wail
+
+echo 'checking for correct man(7) footer on second document' >&2
+echo "$output" | grep -Eqx ' +2020-10-12 +2' || 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]