summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-08 01:36:51 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-04-08 01:36:51 +0000
commit149824b7264545f9974f31e6f67169fbb8b4c5aa (patch)
treea4346fea6ca694967bbb166496d2e86ff0835cc0 /regress
parentd2ccc22d72cf638e29f0322fbde6a4c0a792d006 (diff)
Fully implement the \B (validate numerical expression) and
partially implement the \w (measure text width) escape sequence in a way that makes them usable in numerical expressions and in conditional requests, similar to how \n (interpolate number register) and \* (expand user-defined string) are implemented. This lets mandoc(1) handle the baroque low-level roff code found at the beginning of the ggrep(1) manual. Thanks to pascal@ for the report.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/mandoc/roff/esc/B.in34
-rw-r--r--regress/usr.bin/mandoc/roff/esc/B.out_ascii22
-rw-r--r--regress/usr.bin/mandoc/roff/esc/Makefile4
-rw-r--r--regress/usr.bin/mandoc/roff/esc/w.in14
-rw-r--r--regress/usr.bin/mandoc/roff/esc/w.out_ascii12
5 files changed, 84 insertions, 2 deletions
diff --git a/regress/usr.bin/mandoc/roff/esc/B.in b/regress/usr.bin/mandoc/roff/esc/B.in
new file mode 100644
index 00000000000..84b0f9f157c
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/esc/B.in
@@ -0,0 +1,34 @@
+.Dd April 8, 2014
+.Dt ESC-B 1
+.Os OpenBSD
+.Sh NAME
+.Nm esc-B
+.Nd the roff escape B sequence: validate numerical expression
+.Sh DESCRIPTION
+empty: \B''
+.br
+digit: \B'0'
+.br
+no number: \B'no number'
+.br
+trailing garbage: \B'1X'
+.br
+trailing operator: \B'1+'
+.br
+infix operator: \B'1+1'
+.br
+infix and trailing operator: \B'1+1+'
+.br
+chain of operations: \B'1+2+3+4'
+.br
+trailing para: \B'1+('
+.br
+unclosed para: \B'(1'
+.br
+empty pair of parentheses: \B'()'
+.br
+parentheses containing number: \B'(42)'
+.br
+complex expression: \B'3+(3*(5==5*2)*4)+(3*5)/2'
+.br
+other delimiter: \Bx1+1x
diff --git a/regress/usr.bin/mandoc/roff/esc/B.out_ascii b/regress/usr.bin/mandoc/roff/esc/B.out_ascii
new file mode 100644
index 00000000000..6ea3246655d
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/esc/B.out_ascii
@@ -0,0 +1,22 @@
+ESC-B(1) OpenBSD Reference Manual ESC-B(1)
+
+NNAAMMEE
+ eesscc--BB - the roff escape B sequence: validate numerical expression
+
+DDEESSCCRRIIPPTTIIOONN
+ empty: 0
+ digit: 1
+ no number: 0
+ trailing garbage: 0
+ trailing operator: 0
+ infix operator: 1
+ infix and trailing operator: 0
+ chain of operations: 1
+ trailing para: 0
+ unclosed para: 0
+ empty pair of parentheses: 0
+ parentheses containing number: 1
+ complex expression: 1
+ other delimiter: 1
+
+OpenBSD April 8, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/roff/esc/Makefile b/regress/usr.bin/mandoc/roff/esc/Makefile
index e9705972a80..4fb16774431 100644
--- a/regress/usr.bin/mandoc/roff/esc/Makefile
+++ b/regress/usr.bin/mandoc/roff/esc/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.3 2012/05/28 22:45:34 schwarze Exp $
+# $OpenBSD: Makefile,v 1.4 2014/04/08 01:36:50 schwarze Exp $
-REGRESS_TARGETS=one two multi c f h z ignore
+REGRESS_TARGETS = one two multi B c f h w z ignore
# Postprocessing to remove "character backspace" sequences
# unless they are foolowed by the same character again.
diff --git a/regress/usr.bin/mandoc/roff/esc/w.in b/regress/usr.bin/mandoc/roff/esc/w.in
new file mode 100644
index 00000000000..bd93623e464
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/esc/w.in
@@ -0,0 +1,14 @@
+.Dd April 8, 2014
+.Dt ESC-W 1
+.Os OpenBSD
+.Sh NAME
+.Nm esc-w
+.Nd the roff escape w sequence: text width
+.Sh DESCRIPTION
+empty: \w''
+.br
+character: \w'n'
+.br
+blank: \w' '
+.br
+text: \w'text'
diff --git a/regress/usr.bin/mandoc/roff/esc/w.out_ascii b/regress/usr.bin/mandoc/roff/esc/w.out_ascii
new file mode 100644
index 00000000000..4b11f621f51
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/esc/w.out_ascii
@@ -0,0 +1,12 @@
+ESC-W(1) OpenBSD Reference Manual ESC-W(1)
+
+NNAAMMEE
+ eesscc--ww - the roff escape w sequence: text width
+
+DDEESSCCRRIIPPTTIIOONN
+ empty: 0
+ character: 24
+ blank: 24
+ text: 96
+
+OpenBSD April 8, 2014 OpenBSD