gbranden pushed a commit to branch master
in repository groff.
commit 9cbf8c1b0501c45994fb7691726b15b22130d605
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 20 21:18:35 2026 -0500
[groff]: Test conditional block nesting.
* src/roff/groff/tests/nested-conditional-blocks-work.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
---
ChangeLog | 7 +++
src/roff/groff/groff.am | 1 +
.../groff/tests/nested-conditional-blocks-work.sh | 59 ++++++++++++++++++++++
3 files changed, 67 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0d55a93ba..3a952ad0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-04-19 G. Branden Robinson <[email protected]>
+
+ [groff]: Test conditional block nesting.
+
+ * src/roff/groff/tests/nested-conditional-blocks-work.sh: Do it.
+ * src/roff/groff/groff.am (groff_TESTS): Run test.
+
2026-04-19 G. Branden Robinson <[email protected]>
* src/roff/troff/token.h (class token): Add new member function,
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 9bb2d064b..2885d19ec 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -115,6 +115,7 @@ groff_TESTS = \
src/roff/groff/tests/logical-predicates-work.sh \
src/roff/groff/tests/localization-works.sh \
src/roff/groff/tests/msoquiet-request-works.sh \
+ src/roff/groff/tests/nested-conditional-blocks-work.sh \
src/roff/groff/tests/ns-request-works.sh \
src/roff/groff/tests/output-request-works.sh \
src/roff/groff/tests/pchar-request-works.sh \
diff --git a/src/roff/groff/tests/nested-conditional-blocks-work.sh
b/src/roff/groff/tests/nested-conditional-blocks-work.sh
new file mode 100755
index 000000000..b08d4f478
--- /dev/null
+++ b/src/roff/groff/tests/nested-conditional-blocks-work.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright 2026 G. Branden Robinson
+#
+# This file is part of groff, the GNU roff typesetting system.
+#
+# 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"
+ fail=yes
+}
+
+# Tested nested conditional block behavior.
+
+input='.
+.ec @
+A
+.if 0 @{ B
+C
+D
+@}E
+F
+.br
+N
+.if 1 @{ O
+. if 0 @{ P
+Q
+R@} S@} T
+U
+.'
+
+output=$(printf '%s\n' "$input" | "$groff" -T ascii 2>/dev/null)
+echo "$output"
+
+echo "checking brace escape sequences with false conditional" >&2
+echo "$output" | grep -Fqx 'A F' || wail
+
+echo "checking brace escape sequences with true conditional" >&2
+echo "$output" | grep -Fqx 'N O U' || wail
+
+test -z "$fail"
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit