summaryrefslogtreecommitdiffstats
path: root/regress
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-04-30 18:51:36 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-04-30 18:51:36 +0000
commit9aa6ef8197493fef732a3c196a9405dac78ef349 (patch)
tree709d709b80e078ae5cca7a600e77225e8106ccc9 /regress
parent556f141936dddcdc663288d71ccf7b1a85ec1afe (diff)
downloadmandoc-9aa6ef8197493fef732a3c196a9405dac78ef349.tar.gz
Provide a new function roff_req_or_macro() to parse and handle a request
or macro, including context-dependent error handling inside tbl(7) code and inside .ce/.rj blocks. Use it both in the top level roff(7) parser and inside conditional blocks. This fixes an assertion failure triggered by ".if 1 .ce" inside tbl(7) code, found by tb@ using afl(1). As a side benefit for readability, only one place remains in the code that calls the main handler functions for the various roff(7) requests. This patch also improves column numbers in some error messages and various comments.
Diffstat (limited to 'regress')
-rw-r--r--regress/roff/ce/Makefile9
-rw-r--r--regress/roff/ce/break.in33
-rw-r--r--regress/roff/ce/break.out_ascii24
-rw-r--r--regress/tbl/macro/Makefile13
-rw-r--r--regress/tbl/macro/nested.out_lint2
-rw-r--r--regress/tbl/macro/req.in30
-rw-r--r--regress/tbl/macro/req.out_ascii18
-rw-r--r--regress/tbl/macro/req.out_lint5
8 files changed, 126 insertions, 8 deletions
diff --git a/regress/roff/ce/Makefile b/regress/roff/ce/Makefile
index 2024bdce..2528847e 100644
--- a/regress/roff/ce/Makefile
+++ b/regress/roff/ce/Makefile
@@ -1,5 +1,10 @@
-# $OpenBSD: Makefile,v 1.1 2019/01/04 01:06:44 schwarze Exp $
+# $OpenBSD: Makefile,v 1.2 2022/04/30 18:46:16 schwarze Exp $
-REGRESS_TARGETS = basic
+REGRESS_TARGETS = basic break
+
+# mandoc defect:
+# - For now, high level macros break .ce and .rj blocks.
+
+SKIP_GROFF = break
.include <bsd.regress.mk>
diff --git a/regress/roff/ce/break.in b/regress/roff/ce/break.in
new file mode 100644
index 00000000..69dc99c4
--- /dev/null
+++ b/regress/roff/ce/break.in
@@ -0,0 +1,33 @@
+.\" $OpenBSD: break.in,v 1.1 2022/04/30 18:46:16 schwarze Exp $
+.TH CE-BREAK 1 "April 30, 2022"
+.SH NAME
+ce-break \- centering requests broken by high-level macros
+.SH DESCRIPTION
+initial
+text
+.ce 3
+Text centered with the .ce request is
+.I not
+filled.
+.rj 4
+Text adjusted to the right margin
+works in just the same way and is
+.I not
+filled either.
+.ce
+High-level macros break centering even in a
+.if 1 .I conditional
+block.
+.PP
+.nf
+Now entering
+explicit no-fill mode.
+.ce 3
+Text is still
+.I not
+filled.
+.PP
+.fi
+final
+text
+in fill mode
diff --git a/regress/roff/ce/break.out_ascii b/regress/roff/ce/break.out_ascii
new file mode 100644
index 00000000..8572cc0a
--- /dev/null
+++ b/regress/roff/ce/break.out_ascii
@@ -0,0 +1,24 @@
+CE-BREAK(1) General Commands Manual CE-BREAK(1)
+
+NNAAMMEE
+ ce-break - centering requests broken by high-level macros
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text
+ Text centered with the .ce request is
+ _n_o_t filled.
+ Text adjusted to the right margin
+ works in just the same way and is
+ _n_o_t filled either.
+ High-level macros break centering even in a
+ _c_o_n_d_i_t_i_o_n_a_l block.
+
+ Now entering
+ explicit no-fill mode.
+ Text is still
+ _n_o_t
+ filled.
+
+ final text in fill mode
+
+OpenBSD April 30, 2022 CE-BREAK(1)
diff --git a/regress/tbl/macro/Makefile b/regress/tbl/macro/Makefile
index 70ec1b33..8ea4a0d6 100644
--- a/regress/tbl/macro/Makefile
+++ b/regress/tbl/macro/Makefile
@@ -1,12 +1,15 @@
-# $OpenBSD: Makefile,v 1.2 2016/08/20 14:43:40 schwarze Exp $
+# $OpenBSD: Makefile,v 1.3 2022/04/30 18:46:16 schwarze Exp $
-REGRESS_TARGETS = man nested column
-LINT_TARGETS = man nested
+REGRESS_TARGETS = column man nested req
+LINT_TARGETS = man nested req
-# trivial differences to groff-1.22.3:
+# mandoc defect:
+# mandoc(1) ignores .br inside tbl(7) code.
+
+# trivial differences to groff-1.23.0:
# .TS in a table causes a blank table line in GNU tbl(1), but not in mandoc.
# .TS in a column list causes a blank line in mandoc, but not in GNU tbl(1).
-SKIP_GROFF = nested column
+SKIP_GROFF = column nested req
.include <bsd.regress.mk>
diff --git a/regress/tbl/macro/nested.out_lint b/regress/tbl/macro/nested.out_lint
index dd044ba7..9bffbb0c 100644
--- a/regress/tbl/macro/nested.out_lint
+++ b/regress/tbl/macro/nested.out_lint
@@ -1 +1 @@
-mandoc: nested.in:13:4: UNSUPP: ignoring macro in table: TS
+mandoc: nested.in:13:2: UNSUPP: ignoring macro in table: TS
diff --git a/regress/tbl/macro/req.in b/regress/tbl/macro/req.in
new file mode 100644
index 00000000..30e1fe98
--- /dev/null
+++ b/regress/tbl/macro/req.in
@@ -0,0 +1,30 @@
+.\" $OpenBSD: req.in,v 1.1 2022/04/30 18:46:16 schwarze Exp $
+.TH TBL-MACRO-REQ 1 "April 30, 2022"
+.SH NAME
+tbl-macro-req \- requests generating nodes in a table
+.SH DESCRIPTION
+initial text
+.TS
+box tab(:);
+l | l .
+a:b:stray
+_
+c:T{
+d
+e
+T}
+.ce
+f:T{
+g
+.br
+h
+T}
+.if 1 .ce
+i:T{
+j
+.if 1 .br
+k
+T}
+.TE
+.PP
+final text
diff --git a/regress/tbl/macro/req.out_ascii b/regress/tbl/macro/req.out_ascii
new file mode 100644
index 00000000..168b1ea1
--- /dev/null
+++ b/regress/tbl/macro/req.out_ascii
@@ -0,0 +1,18 @@
+TBL-MACRO-REQ(1) General Commands Manual TBL-MACRO-REQ(1)
+
+NNAAMMEE
+ tbl-macro-req - requests generating nodes in a table
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text
+
+ +--+-----+
+ |a | b |
+ +--+-----+
+ |c | d e |
+ |f | g h |
+ |i | j k |
+ +--+-----+
+ final text
+
+OpenBSD April 30, 2022 TBL-MACRO-REQ(1)
diff --git a/regress/tbl/macro/req.out_lint b/regress/tbl/macro/req.out_lint
new file mode 100644
index 00000000..26af8f71
--- /dev/null
+++ b/regress/tbl/macro/req.out_lint
@@ -0,0 +1,5 @@
+mandoc: req.in:10:5: ERROR: ignoring extra tbl data cells: stray
+mandoc: req.in:16:2: UNSUPP: ignoring macro in table: ce
+mandoc: req.in:19:2: UNSUPP: ignoring macro in table: br
+mandoc: req.in:22:8: UNSUPP: ignoring macro in table: ce
+mandoc: req.in:25:8: UNSUPP: ignoring macro in table: br