groff
[Top][All Lists]
Advanced

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

[PATCH 5/7] [troff]: Regression-test Savannah #45502.


From: G. Branden Robinson
Subject: [PATCH 5/7] [troff]: Regression-test Savannah #45502.
Date: Tue, 9 Apr 2024 23:53:35 -0500

Test fails at this commit.
---
 ChangeLog                                     |  7 +++
 src/roff/groff/groff.am                       |  1 +
 .../tests/degenerate-control-flow-works.sh    | 63 +++++++++++++++++++
 3 files changed, 71 insertions(+)
 create mode 100755 src/roff/groff/tests/degenerate-control-flow-works.sh

diff --git a/ChangeLog b/ChangeLog
index 62d54b5c7..d41cfdf2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,13 @@
        (skip_branch): ...to this.
        (do_if_request, else_request): Update call sites.
 
+2024-04-04  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [troff]: Regression-test Savannah #45502.
+
+       * src/roff/groff/tests/degenerate-control-flow-works.sh: Do it.
+       * src/roff/groff/groff.am (groff_TESTS): Run test.
+
 2024-04-04  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp: Refactor.  Replace bespoke class
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 5c7ed2f3b..0ce7601eb 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -42,6 +42,7 @@ groff_TESTS = \
   src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh \
   src/roff/groff/tests/break_zero-length_output_line_sanely.sh \
   src/roff/groff/tests/cf-request-early-does-not-fail.sh \
+  src/roff/groff/tests/degenerate-control-flow-works.sh \
   src/roff/groff/tests/detect-evil-link-time-optimizer.sh \
   src/roff/groff/tests/device-request-works.sh \
   src/roff/groff/tests/device_control_escapes_express_basic_latin.sh \
diff --git a/src/roff/groff/tests/degenerate-control-flow-works.sh 
b/src/roff/groff/tests/degenerate-control-flow-works.sh
new file mode 100755
index 000000000..0df166f2f
--- /dev/null
+++ b/src/roff/groff/tests/degenerate-control-flow-works.sh
@@ -0,0 +1,63 @@
+#!/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
+}
+
+input='.nm 1
+@
+.if 0
+A
+.if !0
+B
+.ie 0
+C
+.el
+D
+E'
+
+output=$(echo "$input" | "$groff" -W el -T ascii)
+echo "$output"
+
+# Expected:
+#   1 @ A
+#
+#   2 B C
+#
+#   3 D E
+
+echo "checking truncated control flow request behavior (1/3)" >&2
+echo "$output" | grep -q '1 @ A$' || wail
+
+echo "checking truncated control flow request behavior (2/3)" >&2
+echo "$output" | grep -q '2 B C$' || wail
+
+echo "checking truncated control flow request behavior (3/3)" >&2
+echo "$output" | grep -q '3 D E$' || wail
+
+test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=2 tabstop=2 textwidth=72:
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature


reply via email to

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