groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/03: Add regression test for .ad and .na requests.


From: G. Branden Robinson
Subject: [groff] 01/03: Add regression test for .ad and .na requests.
Date: Mon, 25 Jan 2021 23:57:31 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 9d8924c62a57404c8450d5c16a8650c52a539537
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jan 25 17:09:21 2021 +1100

    Add regression test for .ad and .na requests.
    
    * src/roff/groff/tests/adjustment_works.sh: Do it.
    * src/roff/groff/groff.am (groff_TESTS): Run test.
    
    Test will fail at this commit because groff interprets excessively large
    numeric arguments to ".ad" as synonyms for ".ad r".
---
 ChangeLog                                |  7 +++
 src/roff/groff/groff.am                  |  1 +
 src/roff/groff/tests/adjustment_works.sh | 92 ++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index cb3c586..8bc10cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-01-25  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Add regression test for .ad and .na requests.
+
+       * src/roff/groff/tests/adjustment_works.sh: Do it.
+       * src/roff/groff/groff.am (groff_TESTS): Run test.
+
 2021-01-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * doc/groff.texi (Manipulating Filling and Adjustment):
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index f6f001a..60872d0 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -41,6 +41,7 @@ groffoptsdir = $(libprogramdir)
 groffopts_DATA = $(GROFF_OPTS_OUTPUT)
 
 groff_TESTS = \
+  src/roff/groff/tests/adjustment_works.sh \
   src/roff/groff/tests/do_not_loop_infinitely_when_breaking_cjk.sh \
   src/roff/groff/tests/dot-cp_register_works.sh \
   src/roff/groff/tests/on_latin1_device_oq_is_0x27.sh \
diff --git a/src/roff/groff/tests/adjustment_works.sh 
b/src/roff/groff/tests/adjustment_works.sh
new file mode 100755
index 0000000..b79940f
--- /dev/null
+++ b/src/roff/groff/tests/adjustment_works.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# Copyright (C) 2021 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"
+
+set -e
+
+DOC='.pl 1v
+.ll 9n
+foo bar\p
+.na
+foo bar\p
+.ad l
+foo bar\p
+.na
+foo bar\p
+.ad b
+foo bar\p
+.na
+foo bar\p
+.ad c
+foo bar\p
+.na
+foo bar\p
+.ad r
+foo bar\p
+.na
+foo bar\p
+.ad
+foo bar\p
+.ad b
+.ad 100
+foo bar\p'
+
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+B='foo   bar' # 3 spaces
+L='foo bar' # left or off
+C=' foo bar' # trailing space truncated by output driver
+R='  foo bar' # 2 leading spaces
+
+echo "verifying default adjustment mode 'b'" >&2
+echo "$OUTPUT" | sed -n '1p' | grep -Fqx "$B"
+
+echo "verifying that .na works" >&2
+echo "$OUTPUT" | sed -n '2p' | grep -Fqx "$L"
+
+echo "verifying adjustment mode 'l'" >&2
+echo "$OUTPUT" | sed -n '3p' | grep -Fqx "$L"
+
+echo "verifying that .na works after '.ad l'" >&2
+echo "$OUTPUT" | sed -n '4p' | grep -Fqx "$L"
+
+echo "verifying adjustment mode 'b'" >&2
+echo "$OUTPUT" | sed -n '5p' | grep -Fqx "$B"
+
+echo "verifying that .na works after '.ad b'" >&2
+echo "$OUTPUT" | sed -n '6p' | grep -Fqx "$L"
+
+echo "verifying adjustment mode 'c'" >&2
+echo "$OUTPUT" | sed -n '7p' | grep -Fqx "$C"
+
+echo "verifying that .na works after '.ad c'" >&2
+echo "$OUTPUT" | sed -n '8p' | grep -Fqx "$L"
+
+echo "verifying adjustment mode 'r'" >&2
+echo "$OUTPUT" | sed -n '9p' | grep -Fqx "$R"
+
+echo "verifying that .na works after '.ad r'" >&2
+echo "$OUTPUT" | sed -n '10p' | grep -Fqx "$L"
+
+echo "verifying that '.ad' restores previous adjustment mode" >&2
+echo "$OUTPUT" | sed -n '11p' | grep -Fqx "$R"
+
+echo "verifying that out-of-range adjustment mode 100 is ignored" >&2
+echo "$OUTPUT" | sed -n '12p' | grep -Fqx "$B"



reply via email to

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