groff-commit
[Top][All Lists]
Advanced

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

[groff] 11/14: [mdoc]: Add unit test for `Lk` macro.


From: G. Branden Robinson
Subject: [groff] 11/14: [mdoc]: Add unit test for `Lk` macro.
Date: Sun, 28 Jan 2024 19:55:04 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit f2aa83c5fd758cb27677fe2c092a95918ad3daeb
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Jan 28 15:22:40 2024 -0600

    [mdoc]: Add unit test for `Lk` macro.
    
    * tmac/tests/doc_Lk-works.sh: Add unit test.
    * tmac/tmac.am (tmac_TESTS): Run test.
---
 ChangeLog                  |  5 ++++
 tmac/tests/doc_Lk-works.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 tmac/tmac.am               |  1 +
 3 files changed, 65 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 40b21dca5..023a05cc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-01-28  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/tests/doc_Lk-works.sh: Add unit test.
+       * tmac/tmac.am (tmac_TESTS): Run test.
+
 2024-01-28  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/doc.tmac (Mt, Lk): Validate arguments.
diff --git a/tmac/tests/doc_Lk-works.sh b/tmac/tests/doc_Lk-works.sh
new file mode 100755
index 000000000..0fc64904c
--- /dev/null
+++ b/tmac/tests/doc_Lk-works.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright (C) 2024 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 .Lk renders correctly.
+
+input='.Dd 2024-01-28
+.Dt foo 1
+.Os groff test suite
+.Sh Name
+.Nm foo
+.Nd frobnicate a bar
+.Sh Description
+Sometimes you
+.Em click Lk http://example.com one link
+and you get
+.Lk http://another.example.com .'
+
+     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"
+
+echo "checking that conventional Lk macro call works" >&2
+echo "$output" \
+    | grep -Eq '^ +http://another\.example\.com' || wail
+
+echo "checking that inline Lk macro call works" >&2
+echo "$output" \
+    | grep -Eq 'one +link: +http://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 76e54d46b..38c2a180c 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -201,6 +201,7 @@ tmac_TESTS = \
   tmac/tests/doc_CT-works.sh \
   tmac/tests/doc_D-places-page-numbers-correctly.sh \
   tmac/tests/doc_Lk-respect-sentence-ending-punctuation.sh \
+  tmac/tests/doc_Lk-works.sh \
   tmac/tests/doc_Mt-works.sh \
   tmac/tests/doc_Nm-works.sh \
   tmac/tests/doc_P-register-works.sh \



reply via email to

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