aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/regress/roff/cond
diff options
context:
space:
mode:
Diffstat (limited to 'regress/roff/cond')
-rw-r--r--regress/roff/cond/Makefile6
-rw-r--r--regress/roff/cond/before-Dd.in30
-rw-r--r--regress/roff/cond/before-Dd.out_ascii17
-rw-r--r--regress/roff/cond/close.in15
-rw-r--r--regress/roff/cond/close.out_ascii19
-rw-r--r--regress/roff/cond/close.out_lint1
-rw-r--r--regress/roff/cond/ie.in30
-rw-r--r--regress/roff/cond/ie.out_ascii19
-rw-r--r--regress/roff/cond/if.in97
-rw-r--r--regress/roff/cond/if.out_ascii34
-rw-r--r--regress/roff/cond/if.out_lint2
-rw-r--r--regress/roff/cond/numeric.in152
-rw-r--r--regress/roff/cond/numeric.out_ascii41
-rw-r--r--regress/roff/cond/register.in11
-rw-r--r--regress/roff/cond/register.out_ascii14
-rw-r--r--regress/roff/cond/strcmp.in37
-rw-r--r--regress/roff/cond/strcmp.out_ascii18
17 files changed, 543 insertions, 0 deletions
diff --git a/regress/roff/cond/Makefile b/regress/roff/cond/Makefile
new file mode 100644
index 00000000..68a88694
--- /dev/null
+++ b/regress/roff/cond/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.8 2015/05/31 23:12:17 schwarze Exp $
+
+REGRESS_TARGETS = if ie close numeric register strcmp before-Dd
+LINT_TARGETS = if close
+
+.include <bsd.regress.mk>
diff --git a/regress/roff/cond/before-Dd.in b/regress/roff/cond/before-Dd.in
new file mode 100644
index 00000000..6701403b
--- /dev/null
+++ b/regress/roff/cond/before-Dd.in
@@ -0,0 +1,30 @@
+.if n \{.ds mystring mytext
+.\}
+.Dd May 27, 2012
+.Dt IF-BEFORE-DD 1
+.Os OpenBSD
+.Sh NAME
+.Nm if-before-Dd
+.Nd end of if block on its own line before Dd
+.Sh DESCRIPTION
+In an old version of
+.Xr mandoc 1 ,
+.Xr mdoc 7
+file format autodetection failed when the end of an
+.Ic if
+block stood on its own line before the initial
+.Xr mdoc 7
+.Ic Dd
+macro.
+The file was mishandled as
+.Xr man 7
+and parsing failed with unknown macro errors.
+.Pp
+If the present document looks like a proper
+.Xr mdoc 7
+document and the following display reads
+.Dq mytext ,
+then the problem did not come back:
+.Bd -ragged -offset indent
+\*[mystring]
+.Ed
diff --git a/regress/roff/cond/before-Dd.out_ascii b/regress/roff/cond/before-Dd.out_ascii
new file mode 100644
index 00000000..f14a44fe
--- /dev/null
+++ b/regress/roff/cond/before-Dd.out_ascii
@@ -0,0 +1,17 @@
+IF-BEFORE-DD(1) General Commands Manual IF-BEFORE-DD(1)
+
+NNAAMMEE
+ iiff--bbeeffoorree--DDdd - end of if block on its own line before Dd
+
+DDEESSCCRRIIPPTTIIOONN
+ In an old version of mandoc(1), mdoc(7) file format autodetection failed
+ when the end of an iiff block stood on its own line before the initial
+ mdoc(7) DDdd macro. The file was mishandled as man(7) and parsing failed
+ with unknown macro errors.
+
+ If the present document looks like a proper mdoc(7) document and the
+ following display reads ``mytext'', then the problem did not come back:
+
+ mytext
+
+OpenBSD May 27, 2012 OpenBSD
diff --git a/regress/roff/cond/close.in b/regress/roff/cond/close.in
new file mode 100644
index 00000000..7fa91423
--- /dev/null
+++ b/regress/roff/cond/close.in
@@ -0,0 +1,15 @@
+.TH COND-CLOSE 1 2013-06-27 OpenBSD
+.SH NAME
+cond-close \- closing conditional macros
+.SH DESCRIPTION
+.if t \{.unknown \}
+closing after an unknown macro
+.PP
+.if t \{.ig \}
+closing after an ignored macro
+.PP
+.if t \{text \}
+closing after plain text
+.PP
+.if n \{
+still open at the end of the file
diff --git a/regress/roff/cond/close.out_ascii b/regress/roff/cond/close.out_ascii
new file mode 100644
index 00000000..244d4154
--- /dev/null
+++ b/regress/roff/cond/close.out_ascii
@@ -0,0 +1,19 @@
+COND-CLOSE(1) General Commands Manual COND-CLOSE(1)
+
+
+
+NNAAMMEE
+ cond-close - closing conditional macros
+
+DDEESSCCRRIIPPTTIIOONN
+ closing after an unknown macro
+
+ closing after an ignored macro
+
+ closing after plain text
+
+ still open at the end of the file
+
+
+
+OpenBSD 2013-06-27 COND-CLOSE(1)
diff --git a/regress/roff/cond/close.out_lint b/regress/roff/cond/close.out_lint
new file mode 100644
index 00000000..e3419dba
--- /dev/null
+++ b/regress/roff/cond/close.out_lint
@@ -0,0 +1 @@
+mandoc: close.in:14:1: ERROR: appending missing end of block: if
diff --git a/regress/roff/cond/ie.in b/regress/roff/cond/ie.in
new file mode 100644
index 00000000..f9ab8bc0
--- /dev/null
+++ b/regress/roff/cond/ie.in
@@ -0,0 +1,30 @@
+.TH IE 1 "December 16, 2014" OpenBSD
+.SH NAME
+if \- the roff conditional instruction with else-clause
+.SH DESCRIPTION
+.el Initially, else is ignored.
+.ie n One-line true condition.
+.br
+Text following the true condition.
+.el One-line else after true.
+.el Another else after true.
+.br
+.ie t One-line false condition.
+Text following the false condition.
+.br
+.el \{Two-line else
+after false.\}
+.br
+.el Another else after false.
+.br
+.ie
+Text following an empty condition.
+.el Else after empty condition.
+.br
+.ie !
+Text following negated empty condition.
+.el Else after negated empty condition.
+.br
+.ie n If \&.el\e{ works, nothing follows here:
+.el\{dummy
+BOOHOO\}
diff --git a/regress/roff/cond/ie.out_ascii b/regress/roff/cond/ie.out_ascii
new file mode 100644
index 00000000..73d3d97c
--- /dev/null
+++ b/regress/roff/cond/ie.out_ascii
@@ -0,0 +1,19 @@
+IE(1) General Commands Manual IE(1)
+
+
+
+NNAAMMEE
+ if - the roff conditional instruction with else-clause
+
+DDEESSCCRRIIPPTTIIOONN
+ One-line true condition.
+ Text following the true condition.
+ Text following the false condition.
+ Two-line else after false.
+ Else after empty condition.
+ Else after negated empty condition.
+ If .el\{ works, nothing follows here:
+
+
+
+OpenBSD December 16, 2014 IE(1)
diff --git a/regress/roff/cond/if.in b/regress/roff/cond/if.in
new file mode 100644
index 00000000..f243fbdf
--- /dev/null
+++ b/regress/roff/cond/if.in
@@ -0,0 +1,97 @@
+.TH IF 1 "June 27, 2015" OpenBSD
+.SH NAME
+if \- the roff conditional instruction
+.SH DESCRIPTION
+.if n One-line true condition.
+.if t One-line false condition.
+.if n
+Next-line empty true condition.
+.if t
+Next-line empty false condition.
+.br
+False condition with whitespace:
+.br
+.if t
+True condition with whitespace:
+.if n
+.if n \{One-line true cond\}ition with block.
+.if t \{One-line false cond\}ition with block.
+.br
+.if n \{ One-line true cond\}ition with block with leading blanks.
+.if t \{ One-line false cond\}ition with block with leading blanks.
+.br
+.if n \{Two-line true condition
+without cont\}inuation and macros.
+.if t \{Two-line false condition
+without cont\}inuation and macros.
+.br
+.if n \{Two-line true condition
+.B without cont\}inuation but with macros.
+.if t \{Two-line false condition
+.B without cont\}inuation but with macros.
+.br
+.if n \{\
+Two-line true condition
+with continuation and macros.
+.\}This will not be printed.
+.if t \{\
+Two-line false condition
+with continuation and macros.
+.\}This will not be printed.
+.br
+.if n \{
+Two-line true condition with blank line.\}
+.if t \{
+Two-line false condition with blank line.\}
+.br
+.if n \{Outer true condition.
+.br
+.if n Inner one-line true condition.
+.if t Inner one-line false condition.
+.br
+.if n \{Inner two-line true condition
+without continuation and macros.\}
+.if t \{Inner two-line false condition
+without continuation and macros.\}
+.br
+Back to the outer true condition.\}
+.br
+.if t \{Outer false condition.
+.br
+.if n Inner one-line true condition.
+.if t Inner one-line false condition.
+.br
+.if n \{Inner two-line true condition
+without continuation and macros.\}
+.if t \{Inner two-line false condition
+without continuation and macros.\}
+.br
+Back to the outer false condition.\}
+.br
+.if n \{Outer true condition.
+.if t \{Inner false condition.
+inner\}middle\}end
+After conditional.
+.br
+.if n \{Outer true condition.
+.if t \{Inner false condition.
+.\}middle\}end
+After conditional.
+.br
+.if n \{Outer true condition.
+.if n \{Inner true condition.
+.\}middle\}end
+After conditional.
+.br
+.if n \{Outer true condition.
+.if t \{Inner false condition.
+.B\}middle\}end
+After conditional.
+.br
+Backslash-backslash-brace in text:
+.if t \{This text is not printed.\\}
+This neither.\}
+On a macro line:
+.if t \{.B This text\\} is not printed.
+.B This\} neither.
+End.
diff --git a/regress/roff/cond/if.out_ascii b/regress/roff/cond/if.out_ascii
new file mode 100644
index 00000000..7fb9eecc
--- /dev/null
+++ b/regress/roff/cond/if.out_ascii
@@ -0,0 +1,34 @@
+IF(1) General Commands Manual IF(1)
+
+
+
+NNAAMMEE
+ if - the roff conditional instruction
+
+DDEESSCCRRIIPPTTIIOONN
+ One-line true condition.
+
+ Next-line empty true condition.
+ False condition with whitespace:
+ True condition with whitespace:
+
+ One-line true condition with block.
+ One-line true condition with block with leading blanks.
+ Two-line true condition without continuation and macros.
+ Two-line true condition wwiitthhoouutt ccoonnttiinnuuaattiioonn bbuutt wwiitthh mmaaccrrooss..
+ Two-line true condition with continuation and macros.
+
+ Two-line true condition with blank line.
+ Outer true condition.
+ Inner one-line true condition.
+ Inner two-line true condition without continuation and macros.
+ Back to the outer true condition.
+ Outer true condition. After conditional.
+ Outer true condition. After conditional.
+ Outer true condition. Inner true condition. After conditional.
+ Outer true condition. After conditional.
+ Backslash-backslash-brace in text: On a macro line: End.
+
+
+
+OpenBSD June 27, 2015 IF(1)
diff --git a/regress/roff/cond/if.out_lint b/regress/roff/cond/if.out_lint
new file mode 100644
index 00000000..bb8e2d3a
--- /dev/null
+++ b/regress/roff/cond/if.out_lint
@@ -0,0 +1,2 @@
+mandoc: if.in:14:1: WARNING: conditional request controls empty scope: if
+mandoc: if.in:16:1: WARNING: conditional request controls empty scope: if
diff --git a/regress/roff/cond/numeric.in b/regress/roff/cond/numeric.in
new file mode 100644
index 00000000..e96f3087
--- /dev/null
+++ b/regress/roff/cond/numeric.in
@@ -0,0 +1,152 @@
+.TH COND-NUMERIC 1 "December 16, 2014" OpenBSD
+.SH NAME
+cond-numeric \- roff conditions involving numbers
+.SH DESCRIPTION
+positive number:
+plain
+.ie 42 (t)
+.el (f)
+negated
+.ie !42 (t)
+.el (f)
+.PP
+negative number:
+plain
+.ie -42 (t)
+.el (f)
+negated
+.ie !-42 (t)
+.el (f)
+.PP
+second number missing:
+.ie 42=bad worse
+.el ok
+.PP
+operator "<":
+smaller
+.ie 1<2 (t)
+.el (f)
+equal
+.ie 1<1 (t)
+.el (f)
+greater
+.ie 2<1 (t)
+.el (f)
+.PP
+operator "<=":
+smaller
+.ie 1<=2 (t)
+.el (f)
+equal
+.ie 1<=1 (t)
+.el (f)
+greater
+.ie 2<=1 (t)
+.el (f)
+.PP
+operator "=":
+smaller
+.ie 1=2 (t)
+.el (f)
+equal
+.ie 1=1 (t)
+.el (f)
+greater
+.ie 2=1 (t)
+.el (f)
+.PP
+operator "==":
+smaller
+.ie 1==2 (t)
+.el (f)
+equal
+.ie 1==1 (t)
+.el (f)
+greater
+.ie 2==1 (t)
+.el (f)
+.PP
+operator ">=":
+smaller
+.ie 1>=2 (t)
+.el (f)
+equal
+.ie 1>=1 (t)
+.el (f)
+greater
+.ie 2>=1 (t)
+.el (f)
+.PP
+operator ">":
+smaller
+.ie 1>2 (t)
+.el (f)
+equal
+.ie 1>1 (t)
+.el (f)
+greater
+.ie 2>1 (t)
+.el (f)
+.PP
+with negative numbers:
+mm
+.ie -2<-1 (t)
+.el (f)
+mp
+.ie -2<1 (t)
+.el (f)
+pm
+.ie 1>-2 (t)
+.el (f)
+.PP
+operator "&":
+00
+.ie 0&0 (t)
+.el (f)
+01
+.ie 0&1 (t)
+.el (f)
+10
+.ie 1&0 (t)
+.el (f)
+11
+.ie 1&1 (t)
+.el (f)
+.PP
+operator ":":
+00
+.ie 0:0 (t)
+.el (f)
+01
+.ie 0:1 (t)
+.el (f)
+10
+.ie 1:0 (t)
+.el (f)
+11
+.ie 1:1 (t)
+.el (f)
+.PP
+with scaling units:
+1i>2c
+.ie 1i>2c (t)
+.el (f)
+1i-6P
+.ie 1i-6P (t)
+.el (f)
+.PP
+unmatched parenthesis:
+.ie (
+(t)
+.el (f)
+one
+.ie (1 (t)
+.el (f)
+.PP
+negated unmatched parenthesis:
+.ie !(
+(t)
+.el (f)
+zero
+.ie !(0 (t)
+.el (f)
diff --git a/regress/roff/cond/numeric.out_ascii b/regress/roff/cond/numeric.out_ascii
new file mode 100644
index 00000000..35973672
--- /dev/null
+++ b/regress/roff/cond/numeric.out_ascii
@@ -0,0 +1,41 @@
+COND-NUMERIC(1) General Commands Manual COND-NUMERIC(1)
+
+
+
+NNAAMMEE
+ cond-numeric - roff conditions involving numbers
+
+DDEESSCCRRIIPPTTIIOONN
+ positive number: plain (t) negated (f)
+
+ negative number: plain (f) negated (t)
+
+ second number missing: ok
+
+ operator "<": smaller (t) equal (f) greater (f)
+
+ operator "<=": smaller (t) equal (t) greater (f)
+
+ operator "=": smaller (f) equal (t) greater (f)
+
+ operator "==": smaller (f) equal (t) greater (f)
+
+ operator ">=": smaller (f) equal (t) greater (t)
+
+ operator ">": smaller (f) equal (f) greater (t)
+
+ with negative numbers: mm (t) mp (t) pm (t)
+
+ operator "&": 00 (f) 01 (f) 10 (f) 11 (t)
+
+ operator ":": 00 (f) 01 (t) 10 (t) 11 (t)
+
+ with scaling units: 1i>2c (t) 1i-6P (f)
+
+ unmatched parenthesis: (f) one (t)
+
+ negated unmatched parenthesis: (f) zero (t)
+
+
+
+OpenBSD December 16, 2014 COND-NUMERIC(1)
diff --git a/regress/roff/cond/register.in b/regress/roff/cond/register.in
new file mode 100644
index 00000000..d8c9629b
--- /dev/null
+++ b/regress/roff/cond/register.in
@@ -0,0 +1,11 @@
+.TH REGISTER 1 "May 31, 2015" OpenBSD
+.SH NAME
+register \- conditional testing whether a register is defined
+.SH DESCRIPTION
+.ie rmyreg OOPS
+.el not yet defined
+.br
+.nr myreg 0
+.ie rmyreg now defined
+.el OOPS
+.if !rmyreg OOPS
diff --git a/regress/roff/cond/register.out_ascii b/regress/roff/cond/register.out_ascii
new file mode 100644
index 00000000..acd0f724
--- /dev/null
+++ b/regress/roff/cond/register.out_ascii
@@ -0,0 +1,14 @@
+REGISTER(1) General Commands Manual REGISTER(1)
+
+
+
+NNAAMMEE
+ register - conditional testing whether a register is defined
+
+DDEESSCCRRIIPPTTIIOONN
+ not yet defined
+ now defined
+
+
+
+OpenBSD May 31, 2015 REGISTER(1)
diff --git a/regress/roff/cond/strcmp.in b/regress/roff/cond/strcmp.in
new file mode 100644
index 00000000..eabe80ff
--- /dev/null
+++ b/regress/roff/cond/strcmp.in
@@ -0,0 +1,37 @@
+.TH COND-STRCMP 1 "March 8, 2014" OpenBSD
+.SH NAME
+cond-strcmp \- roff conditions involving string comparison
+.SH DESCRIPTION
+empty:
+.ie """ (t)
+.el (f)
+one char:
+.ie xaxax (t)
+.el (f)
+three chars:
+.ie xabcxabcx (t)
+.el (f)
+.br
+mismatch:
+.ie xabcxabdx (t)
+.el (f)
+longer:
+.ie xabcxabcdx (t)
+.el (f)
+shorter:
+.ie xabcdxabcx (t)
+.el (f)
+.br
+no middle:
+.ie xabc (t)
+.el (f)
+no end:
+.ie xabcxabc
+.el (f)
+.SS Negation
+match:
+.ie !xabcxabcx (t)
+.el (f)
+mismatch:
+.ie !xaxbx (t)
+.el (f)
diff --git a/regress/roff/cond/strcmp.out_ascii b/regress/roff/cond/strcmp.out_ascii
new file mode 100644
index 00000000..9268dec8
--- /dev/null
+++ b/regress/roff/cond/strcmp.out_ascii
@@ -0,0 +1,18 @@
+COND-STRCMP(1) General Commands Manual COND-STRCMP(1)
+
+
+
+NNAAMMEE
+ cond-strcmp - roff conditions involving string comparison
+
+DDEESSCCRRIIPPTTIIOONN
+ empty: (t) one char: (t) three chars: (t)
+ mismatch: (f) longer: (f) shorter: (f)
+ no middle: (f) no end: (f)
+
+ NNeeggaattiioonn
+ match: (f) mismatch: (t)
+
+
+
+OpenBSD March 8, 2014 COND-STRCMP(1)