summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-01-28 21:10:29 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-01-28 21:10:29 +0000
commit36f99479f42328cc901ce75400150b7e8bb86bfd (patch)
treef2d293407ad3c58139532adaf86843eeb366c9fe /regress/usr.bin
parent098d80b53c0c59d1f8acbeef29a25913a170e850 (diff)
Clean up eqn(7) error handling:
* When "define" fails, do not drop the whole equation. * Free memory after "undef". * Use standard mandoc error types instead of rolling our own. * Delete obfuscating EQN_MSG() macro. * Add function prototypes while here.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/mandoc/eqn/Makefile4
-rw-r--r--regress/usr.bin/mandoc/eqn/define/Makefile6
-rw-r--r--regress/usr.bin/mandoc/eqn/define/invalid.in36
-rw-r--r--regress/usr.bin/mandoc/eqn/define/invalid.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/eqn/define/invalid.out_lint5
5 files changed, 66 insertions, 2 deletions
diff --git a/regress/usr.bin/mandoc/eqn/Makefile b/regress/usr.bin/mandoc/eqn/Makefile
index c996bdf124b..ef5effd16c0 100644
--- a/regress/usr.bin/mandoc/eqn/Makefile
+++ b/regress/usr.bin/mandoc/eqn/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.1 2015/01/01 12:53:46 schwarze Exp $
+# $OpenBSD: Makefile,v 1.2 2015/01/28 21:10:28 schwarze Exp $
-SUBDIR = fromto matrix nullary over size subsup unary
+SUBDIR = fromto define matrix nullary over size subsup unary
.include "../Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/eqn/define/Makefile b/regress/usr.bin/mandoc/eqn/define/Makefile
new file mode 100644
index 00000000000..4be9cf5ebed
--- /dev/null
+++ b/regress/usr.bin/mandoc/eqn/define/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2015/01/28 21:10:28 schwarze Exp $
+
+REGRESS_TARGETS = invalid
+LINT_TARGETS = invalid
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/eqn/define/invalid.in b/regress/usr.bin/mandoc/eqn/define/invalid.in
new file mode 100644
index 00000000000..aa8bcb8c9dc
--- /dev/null
+++ b/regress/usr.bin/mandoc/eqn/define/invalid.in
@@ -0,0 +1,36 @@
+.Dd January 28, 2015
+.Dt DEFINE-INVALID 1
+.Os OpenBSD
+.Sh NAME
+.Nm define-invalid
+.Nd invalid define and undef statements
+.Sh DESCRIPTION
+define without variable name:
+.EQ
+define bruch 'over' 1 bruch 2 undef bruch bruch define
+.EN
+eol
+.Pp
+define without value:
+.EQ
+define bruch 'over' 1 bruch 2 undef bruch bruch define bruch
+.EN
+eol
+.Pp
+define without value:
+.EQ
+define bruch 'over' 1 bruch 2 undef bruch bruch undef
+.EN
+eol
+.Pp
+tdefine without variable name:
+.EQ
+tdefine
+.EN
+eol
+.Pp
+tdefine without value:
+.EQ
+tdefine bruch
+.EN
+eol
diff --git a/regress/usr.bin/mandoc/eqn/define/invalid.out_ascii b/regress/usr.bin/mandoc/eqn/define/invalid.out_ascii
new file mode 100644
index 00000000000..0725dde22a3
--- /dev/null
+++ b/regress/usr.bin/mandoc/eqn/define/invalid.out_ascii
@@ -0,0 +1,17 @@
+DEFINE-INVALID(1) General Commands Manual DEFINE-INVALID(1)
+
+NNAAMMEE
+ ddeeffiinnee--iinnvvaalliidd - invalid define and undef statements
+
+DDEESSCCRRIIPPTTIIOONN
+ define without variable name: 1/2 bruch eol
+
+ define without value: 1/2 bruch eol
+
+ define without value: 1/2 bruch eol
+
+ tdefine without variable name: eol
+
+ tdefine without value: eol
+
+OpenBSD January 28, 2015 OpenBSD
diff --git a/regress/usr.bin/mandoc/eqn/define/invalid.out_lint b/regress/usr.bin/mandoc/eqn/define/invalid.out_lint
new file mode 100644
index 00000000000..3f2304004dc
--- /dev/null
+++ b/regress/usr.bin/mandoc/eqn/define/invalid.out_lint
@@ -0,0 +1,5 @@
+mandoc: invalid.in:9:1: WARNING: skipping empty request: define
+mandoc: invalid.in:15:1: WARNING: skipping empty request: define bruch
+mandoc: invalid.in:21:1: WARNING: skipping empty request: undef
+mandoc: invalid.in:27:1: WARNING: skipping empty request: tdefine
+mandoc: invalid.in:33:1: WARNING: skipping empty request: tdefine