groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/126: [mm]: Add unit test for indexing feature.


From: G. Branden Robinson
Subject: [groff] 06/126: [mm]: Add unit test for indexing feature.
Date: Wed, 5 Jul 2023 17:02:44 -0400 (EDT)

gbranden pushed a commit to branch branden-2023-07-05
in repository groff.

commit bef88ba59c97e0a62f874f385d7121afe980624e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Jun 30 17:33:51 2023 -0500

    [mm]: Add unit test for indexing feature.
    
    * contrib/mm/tests/indexing-works.sh: Add unit test.
    
    * contrib/mm/mm.am (mm_TESTS): Run test.
---
 contrib/mm/ChangeLog               |  5 ++++
 contrib/mm/mm.am                   |  1 +
 contrib/mm/tests/indexing-works.sh | 58 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 6c17811cf..d1c1523fc 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,8 @@
+2023-06-30  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tests/indexing-works.sh: Add unit test.
+       * mm.am (mm_TESTS): Run test.
+
 2023-05-25  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * groff_mm.7.man (Macros) <INDP>: Clarify operation.
diff --git a/contrib/mm/mm.am b/contrib/mm/mm.am
index 191dbce44..6947c6f4e 100644
--- a/contrib/mm/mm.am
+++ b/contrib/mm/mm.am
@@ -66,6 +66,7 @@ mm_TESTS = \
   contrib/mm/tests/MT-1-reports-all-TM-numbers.sh \
   contrib/mm/tests/MT_5_includes_AT_in_SG.sh \
   contrib/mm/tests/P-indentation-works.sh \
+  contrib/mm/tests/indexing-works.sh \
   contrib/mm/tests/ms_cover_sheet_robust_to_missing_AF.sh \
   contrib/mm/tests/mse_has-sufficient-footnote-space.sh \
   contrib/mm/tests/place-equation-labels-correctly-in-displays.sh \
diff --git a/contrib/mm/tests/indexing-works.sh 
b/contrib/mm/tests/indexing-works.sh
new file mode 100755
index 000000000..77a4a31fd
--- /dev/null
+++ b/contrib/mm/tests/indexing-works.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+# Copyright (C) 2023 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='.INITI N index
+.P
+.IND convolution
+Laplace
+.bp
+.P
+.IND involution
+Rothe
+.INDP'
+
+output=$(printf "%s\n" "$input" \
+    | "$groff" -rRef=1 -mm -z -Tascii -P-cbou 2>&1)
+echo "$output"
+
+# Expected (on standard error):
+# .\" IND convolution     1
+# .\" IND involution      2
+# .\" Index: index.ind
+
+echo "$output" | grep -qx '\.\\"  *IND  *convolution.*1' \
+    || wail "check for 'convolution' index entry failed"
+echo "$output" | grep -qx '\.\\"  *IND  *involution.*2' \
+    || wail "check for 'involution' index entry failed"
+echo "$output" | grep -qx '\.\\"  *Index:  *index.ind' \
+    || wail "check for index file name failed"
+
+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]