summaryrefslogtreecommitdiff
path: root/regress/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-18 17:35:41 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-18 17:35:41 +0000
commitf7b46abbbf4d67f29569620afdfd1c6b3b6e2ac6 (patch)
tree0ba9f5d0a5e15363c174ebe0ab31b2e470257b94 /regress/usr.bin/mandoc
parent554db0131803be76055dc5c9b56d21d88bcf28f8 (diff)
Implement appending to standard man(7) and mdoc(7) macros with .am.
With roff_getstrn(), provide finer control which definitions can be used for what: * All definitions can be used for .if d tests and .am appending. * User-defined for \* expansion, .dei expansion, and macro calling. * Predefined for \* expansion. * Standard macros, original or renamed, for macro calling. Several related improvements while here: * Do not return string table entries that have explicitly been removed. * Do not create a rentab entry when trying to rename a non-existent macro. * Clear an existing rentab entry when the external interface roff_setstr() is called with its name. * Avoid trailing blanks in macro lines generated from renamed and from aliased macros. * Delete the duplicate __m*_reserved[] tables, just use roff_name[].
Diffstat (limited to 'regress/usr.bin/mandoc')
-rw-r--r--regress/usr.bin/mandoc/roff/Makefile4
-rw-r--r--regress/usr.bin/mandoc/roff/cond/string.in4
-rw-r--r--regress/usr.bin/mandoc/roff/cond/string.out_ascii2
-rw-r--r--regress/usr.bin/mandoc/roff/de/append.in13
-rw-r--r--regress/usr.bin/mandoc/roff/de/append.out_ascii6
-rw-r--r--regress/usr.bin/mandoc/roff/rn/Makefile5
-rw-r--r--regress/usr.bin/mandoc/roff/rn/append.in23
-rw-r--r--regress/usr.bin/mandoc/roff/rn/append.out_ascii13
-rw-r--r--regress/usr.bin/mandoc/roff/string/Makefile12
-rw-r--r--regress/usr.bin/mandoc/roff/string/std.in10
-rw-r--r--regress/usr.bin/mandoc/roff/string/std.out_ascii15
-rw-r--r--regress/usr.bin/mandoc/roff/string/std.out_lint3
12 files changed, 102 insertions, 8 deletions
diff --git a/regress/usr.bin/mandoc/roff/Makefile b/regress/usr.bin/mandoc/roff/Makefile
index 9d32cba9e0f..7afa56d9b53 100644
--- a/regress/usr.bin/mandoc/roff/Makefile
+++ b/regress/usr.bin/mandoc/roff/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.23 2017/06/14 22:50:37 schwarze Exp $
+# $OpenBSD: Makefile,v 1.24 2017/06/18 17:35:40 schwarze Exp $
SUBDIR = args cond esc scale string
-SUBDIR += br cc de ds ft ig it ll na nr po ps rm sp ta ti tr
+SUBDIR += br cc de ds ft ig it ll na nr po ps rm rn sp ta ti tr
.include "../Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/roff/cond/string.in b/regress/usr.bin/mandoc/roff/cond/string.in
index 6d19f4ce2b8..4f27a4922ca 100644
--- a/regress/usr.bin/mandoc/roff/cond/string.in
+++ b/regress/usr.bin/mandoc/roff/cond/string.in
@@ -27,3 +27,7 @@ mymacval
.ie d myren now defined
.el OOPS
.if !d myren OOPS
+.PP
+standard macro is
+.ie d PP defined
+.el not defined \(em OOPS
diff --git a/regress/usr.bin/mandoc/roff/cond/string.out_ascii b/regress/usr.bin/mandoc/roff/cond/string.out_ascii
index 8df491ac06d..b5075d21f9c 100644
--- a/regress/usr.bin/mandoc/roff/cond/string.out_ascii
+++ b/regress/usr.bin/mandoc/roff/cond/string.out_ascii
@@ -15,6 +15,8 @@ DDEESSCCRRIIPPTTIIOONN
myren not yet defined
now defined
+ standard macro is defined
+
OpenBSD June 14, 2017 STRING(1)
diff --git a/regress/usr.bin/mandoc/roff/de/append.in b/regress/usr.bin/mandoc/roff/de/append.in
index cdc01bdd877..9e76f6d0d07 100644
--- a/regress/usr.bin/mandoc/roff/de/append.in
+++ b/regress/usr.bin/mandoc/roff/de/append.in
@@ -1,4 +1,4 @@
-.Dd July 7, 2014
+.Dd June 18, 2017
.Dt DE-APPEND 1
.Os OpenBSD
.Sh NAME
@@ -23,3 +23,14 @@ ami:
.mye
.mym
end
+.Pp
+standard macro:
+.Bo in brackets
+.Bc end
+.Pp
+append to standard macro:
+.am Bc
+.Pq appended words
+..
+.Bo in brackets
+.Bc end
diff --git a/regress/usr.bin/mandoc/roff/de/append.out_ascii b/regress/usr.bin/mandoc/roff/de/append.out_ascii
index c5f4363cf96..6230f3b235e 100644
--- a/regress/usr.bin/mandoc/roff/de/append.out_ascii
+++ b/regress/usr.bin/mandoc/roff/de/append.out_ascii
@@ -6,4 +6,8 @@ NNAAMMEE
DDEESSCCRRIIPPTTIIOONN
de: OpenBSD am: OpenBSD NetBSD ami: OpenBSD NetBSD FreeBSD end
-OpenBSD July 7, 2014 OpenBSD
+ standard macro: [in brackets] end
+
+ append to standard macro: [in brackets] end (appended words)
+
+OpenBSD June 18, 2017 OpenBSD
diff --git a/regress/usr.bin/mandoc/roff/rn/Makefile b/regress/usr.bin/mandoc/roff/rn/Makefile
new file mode 100644
index 00000000000..4fe29d76f5c
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/rn/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2017/06/18 17:35:40 schwarze Exp $
+
+REGRESS_TARGETS = append
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/roff/rn/append.in b/regress/usr.bin/mandoc/roff/rn/append.in
new file mode 100644
index 00000000000..5ae2cfb1785
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/rn/append.in
@@ -0,0 +1,23 @@
+.Dd June 18, 2017
+.Dt RN-APPEND 1
+.Os OpenBSD
+.Sh NAME
+.Nm rn-append
+.Nd append to renamed standard macro
+.Sh DESCRIPTION
+original macro:
+.Bo in brackets
+.Bc
+.Pp
+renamed macro:
+.rn Bc myBc
+.Bo in brackets
+.myBc
+.Pp
+appending to macro:
+.am myBc
+.Pq appended words
+..
+.Bo more in brackets
+.myBc
+final text
diff --git a/regress/usr.bin/mandoc/roff/rn/append.out_ascii b/regress/usr.bin/mandoc/roff/rn/append.out_ascii
new file mode 100644
index 00000000000..99b61d79372
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/rn/append.out_ascii
@@ -0,0 +1,13 @@
+RN-APPEND(1) General Commands Manual RN-APPEND(1)
+
+NNAAMMEE
+ rrnn--aappppeenndd - append to renamed standard macro
+
+DDEESSCCRRIIPPTTIIOONN
+ original macro: [in brackets]
+
+ renamed macro: [in brackets]
+
+ appending to macro: [more in brackets] (appended words) final text
+
+OpenBSD June 18, 2017 OpenBSD
diff --git a/regress/usr.bin/mandoc/roff/string/Makefile b/regress/usr.bin/mandoc/roff/string/Makefile
index d2cd125ba44..be5c76260bc 100644
--- a/regress/usr.bin/mandoc/roff/string/Makefile
+++ b/regress/usr.bin/mandoc/roff/string/Makefile
@@ -1,11 +1,15 @@
-# $OpenBSD: Makefile,v 1.6 2014/07/06 19:08:57 schwarze Exp $
+# $OpenBSD: Makefile,v 1.7 2017/06/18 17:35:40 schwarze Exp $
-REGRESS_TARGETS=escape infinite zerolength name
-LINT_TARGETS = name
+REGRESS_TARGETS = escape infinite name std zerolength
+LINT_TARGETS = name std
# The infinite test fails badly with groff-1.20.1:
# It fails to print the following text.
-SKIP_GROFF ?= infinite
+SKIP_GROFF ?= infinite
+
+# Groff can expand standard macros as strings, but mandoc cannot.
+
+SKIP_GROFF += std
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/roff/string/std.in b/regress/usr.bin/mandoc/roff/string/std.in
new file mode 100644
index 00000000000..f460b1014c6
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/string/std.in
@@ -0,0 +1,10 @@
+.TH STRING-STD 1 "June 18, 2017" OpenBSD
+.SH NAME
+string-std - expanding standard macros as strings
+.SH DESCRIPTION
+expanding the DT macro as a string:
+>>>\*[DT]<<<
+.PP
+.rn DT myname
+the same after renaming it:
+>>>\*[myname]<<<
diff --git a/regress/usr.bin/mandoc/roff/string/std.out_ascii b/regress/usr.bin/mandoc/roff/string/std.out_ascii
new file mode 100644
index 00000000000..b399374c0dc
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/string/std.out_ascii
@@ -0,0 +1,15 @@
+STRING-STD(1) General Commands Manual STRING-STD(1)
+
+
+
+NNAAMMEE
+ string-std - expanding standard macros as strings
+
+DDEESSCCRRIIPPTTIIOONN
+ expanding the DT macro as a string: >>><<<
+
+ the same after renaming it: >>><<<
+
+
+
+OpenBSD June 18, 2017 STRING-STD(1)
diff --git a/regress/usr.bin/mandoc/roff/string/std.out_lint b/regress/usr.bin/mandoc/roff/string/std.out_lint
new file mode 100644
index 00000000000..3f4dee3066b
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/string/std.out_lint
@@ -0,0 +1,3 @@
+mandoc: std.in:6:4: WARNING: undefined string, using "": DT
+mandoc: std.in:10:4: WARNING: undefined string, using "": myname
+mandoc: std.in: STYLE: RCS id missing