groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/02: [mdoc,tests]: Add cases to `Lk`, `Mt`, `Xr` tests.


From: G. Branden Robinson
Subject: [groff] 01/02: [mdoc,tests]: Add cases to `Lk`, `Mt`, `Xr` tests.
Date: Sun, 25 Feb 2024 02:35:32 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 843aba55b26ae7b4de0ef30f1c516bf16066ff83
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Feb 24 16:39:26 2024 -0600

    [mdoc,tests]: Add cases to `Lk`, `Mt`, `Xr` tests.
    
    Verify correct operation with use of `Pf` macro.
    
    * tmac/tests/doc_Lk-works.sh:
    * tmac/tests/doc_Mt-works.sh:
    * tmac/tests/doc_Xr-works.sh: Do it.
---
 tmac/tests/doc_Lk-works.sh | 20 +++++++++++++++-----
 tmac/tests/doc_Mt-works.sh | 22 ++++++++++++++--------
 tmac/tests/doc_Xr-works.sh | 14 ++++++++++----
 3 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/tmac/tests/doc_Lk-works.sh b/tmac/tests/doc_Lk-works.sh
index c59eee064..7ad621be3 100755
--- a/tmac/tests/doc_Lk-works.sh
+++ b/tmac/tests/doc_Lk-works.sh
@@ -28,7 +28,7 @@ wail() {
 
 # Ensure .Lk renders correctly.
 
-input='.Dd 2024-01-28
+input='.Dd 2024-02-22
 .Dt foo 1
 .Os groff test suite
 .Sh Name
@@ -38,14 +38,19 @@ input='.Dd 2024-01-28
 Sometimes you
 .Em click Lk http://example.com one link
 and you get
-.Lk http://another.example.com .'
+.Lk http://another.example.com .
+.Pp
+Follow instructions
+.Pf ( Lk http://\:hidden\:.example\:.com elsewhere ) .'
+
+output=$(echo "$input" | "$groff" -mdoc -Tascii -P-cbou)
+echo "$output"
 
 # Expected:
 #     Sometimes   you   click   one   link:   http://example.com   and   you  
get
 #     http://another.example.com.
-
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -mdoc)
-echo "$output"
+#
+#     Follow instructions (elsewhere: http://hidden.example.com).
 
 echo "checking that conventional Lk macro call works" >&2
 echo "$output" \
@@ -55,6 +60,11 @@ echo "checking that inline Lk macro call works" >&2
 echo "$output" \
     | grep -Eq 'one +link: +http://example\.com' || wail
 
+echo "checking that prefixed Lk macro call works" >&2
+echo "$output" \
+    | grep -Fq 'instructions (elsewhere: http://hidden.example.com).' \
+    || wail
+
 test -z "$fail"
 
 # vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tests/doc_Mt-works.sh b/tmac/tests/doc_Mt-works.sh
index 8a4a78251..4a6b9fbb7 100755
--- a/tmac/tests/doc_Mt-works.sh
+++ b/tmac/tests/doc_Mt-works.sh
@@ -41,23 +41,29 @@ input='.Dd 2021-02-10
 The
 .Nm mandoc
 utility was written by
-.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
-and is maintained by
+.An Kristaps Dzonsons ,
+reachable at
+.Mt kristaps@bsd.lv ,
+and maintained by
 .An Ingo Schwarze Aq Mt schwarze@openbsd.org .
-Certainly
-.Mt bogus@example.com
-had nothing to do with it.'
+Certainly that scoundrel Bob Bogus
+.Pf ( Mt bogus@example.com )
+played no role.'
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -mdoc)
+output=$(echo "$input" | "$groff" -mdoc -Tascii -P-cbou)
 echo "$output"
 
 echo "checking that conventional Mt macro call works" >&2
 echo "$output" \
-    | grep -Eq '^ +bogus@example\.com' || wail
+    | grep -Eq '^ +kristaps@bsd\.lv,' || wail
 
 echo "checking that inline Mt macro call works" >&2
 echo "$output" \
-    | grep -Fq 'written by Kristaps Dzonsons <kristaps@bsd.lv>' || wail
+    | grep -Eq 'Schwarze +<schwarze@openbsd\.org>' || wail
+
+echo "checking that prefixed Mt macro call works" >&2
+echo "$output" \
+    | grep -Fq 'Bogus (bogus@example.com) played' || wail
 
 test -z "$fail"
 
diff --git a/tmac/tests/doc_Xr-works.sh b/tmac/tests/doc_Xr-works.sh
index 5706431cf..26520cf42 100755
--- a/tmac/tests/doc_Xr-works.sh
+++ b/tmac/tests/doc_Xr-works.sh
@@ -46,6 +46,8 @@ Read the man page
 .Xr groff 1 ,
 reflect,
 and find enlightenment.
+.Pf ( Xr groff_font 5
+is also worth a look.)
 .Pp
 The
 .Xr groff ,
@@ -54,8 +56,8 @@ and
 .Xr roff
 pages in section 7 are also illuminating.'
 
-output=$(echo "$input" | "$groff" -Tascii -P-cbou -mdoc 2>/dev/null)
-error=$(echo "$input" | "$groff" -Tascii -P-cbou -mdoc 2>&1 >/dev/null)
+output=$(echo "$input" | "$groff" -mdoc -Tascii -P-cbou 2>/dev/null)
+error=$(echo "$input" | "$groff" -mdoc -Tascii -P-cbou 2>&1 >/dev/null)
 echo "$output"
 echo "$error"
 
@@ -67,14 +69,18 @@ echo "$output" \
     | grep -Fq 'Read the groff(1) man page.' || wail
 
 echo "checking two-argument Xr call with partial reference and" \
-   "trailing punctuation" >&2
+    "trailing punctuation" >&2
 echo "$output" \
-    | grep -Fq 'Read the man page groff(1), reflect,' || wail
+    | grep -Eq 'Read +the +man +page +groff\(1\), +reflect,' || wail
 
 echo "checking a series of partial references, some punctuated" >&2
 echo "$output" \
     | grep -Fq 'The groff, groff_diff, and roff pages' || wail
 
+echo "checking that prefixed Xr macro call works" >&2
+echo "$output" \
+    | grep -Fq '(groff_font(5) is also worth a look.)' || 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]