summaryrefslogtreecommitdiffstats
path: root/regress/roff/shift
diff options
context:
space:
mode:
Diffstat (limited to 'regress/roff/shift')
-rw-r--r--regress/roff/shift/Makefile6
-rw-r--r--regress/roff/shift/bad.in30
-rw-r--r--regress/roff/shift/bad.out_ascii25
-rw-r--r--regress/roff/shift/bad.out_lint7
-rw-r--r--regress/roff/shift/basic.in35
-rw-r--r--regress/roff/shift/basic.out_ascii25
6 files changed, 128 insertions, 0 deletions
diff --git a/regress/roff/shift/Makefile b/regress/roff/shift/Makefile
new file mode 100644
index 00000000..d356b963
--- /dev/null
+++ b/regress/roff/shift/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2018/08/23 14:16:12 schwarze Exp $
+
+REGRESS_TARGETS = basic bad
+LINT_TARGETS = bad
+
+.include <bsd.regress.mk>
diff --git a/regress/roff/shift/bad.in b/regress/roff/shift/bad.in
new file mode 100644
index 00000000..809832de
--- /dev/null
+++ b/regress/roff/shift/bad.in
@@ -0,0 +1,30 @@
+.\" $OpenBSD: bad.in,v 1.1 2018/08/23 14:16:12 schwarze Exp $
+.TH SHIFT_BAD 1 "August 23, 2018"
+.SH NAME
+.B shift-bad
+\(en wrong usage of macro arguments
+.SH DESCRIPTION
+initial text
+.de mym
+in macro: "\\$1"
+.PP
+invalid argument number 'x': "\\$x"
+..
+.PP
+argument used before call: "\$1"
+.shift
+.PP
+.mym argument
+.PP
+argument used after call: "\$1"
+.shift 2
+.PP
+.de mym
+.shift badarg
+after shift badarg: "\\$1"
+.shift 2
+after excessive shift: \\n(.$ "\\$1"
+..
+.mym arg1 arg2
+.PP
+final text
diff --git a/regress/roff/shift/bad.out_ascii b/regress/roff/shift/bad.out_ascii
new file mode 100644
index 00000000..0b21f574
--- /dev/null
+++ b/regress/roff/shift/bad.out_ascii
@@ -0,0 +1,25 @@
+SHIFT_BAD(1) General Commands Manual SHIFT_BAD(1)
+
+
+
+NNAAMMEE
+ sshhiifftt--bbaadd - wrong usage of macro arguments
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text
+
+ argument used before call: ""
+
+ in macro: "argument"
+
+ invalid argument number 'x': ""
+
+ argument used after call: ""
+
+ after shift badarg: "arg2" after excessive shift: 0 ""
+
+ final text
+
+
+
+OpenBSD August 23, 2018 SHIFT_BAD(1)
diff --git a/regress/roff/shift/bad.out_lint b/regress/roff/shift/bad.out_lint
new file mode 100644
index 00000000..1f696fc8
--- /dev/null
+++ b/regress/roff/shift/bad.out_lint
@@ -0,0 +1,7 @@
+mandoc: bad.in:14:29: ERROR: using macro argument outside macro: \$1
+mandoc: bad.in:15:2: ERROR: ignoring request outside macro: shift
+mandoc: bad.in:17:31: ERROR: argument number is not numeric: \$x
+mandoc: bad.in:19:28: ERROR: using macro argument outside macro: \$1
+mandoc: bad.in:20:2: ERROR: ignoring request outside macro: shift
+mandoc: bad.in:28:8: ERROR: argument is not numeric, using 1: shift badarg
+mandoc: bad.in:28:9: ERROR: excessive shift: 2, but max is 1
diff --git a/regress/roff/shift/basic.in b/regress/roff/shift/basic.in
new file mode 100644
index 00000000..982042db
--- /dev/null
+++ b/regress/roff/shift/basic.in
@@ -0,0 +1,35 @@
+.\" $OpenBSD: basic.in,v 1.1 2018/08/23 14:16:12 schwarze Exp $
+.TH SHIFT_BASIC 1 "August 23, 2018"
+.SH NAME
+.B shift-basic
+\(en the shift request
+.SH DESCRIPTION
+.de showargs
+original arguments:
+.BI \\$@
+.PP
+.shift 2
+after shift 2:
+.BI \\$@
+.PP
+.shift
+after shift without argument:
+.BI \\$@
+.PP
+.shift 0
+after shift 0:
+.BI \\$@
+..
+.de useargs
+<\\$*>
+..
+.showargs one two three four five
+.PP
+expand to less than three bytes:
+.useargs 1
+.PP
+expand to exactly three bytes:
+.useargs x y
+.PP
+expand to more than three bytes:
+.useargs "a longer argument..." "and another"
diff --git a/regress/roff/shift/basic.out_ascii b/regress/roff/shift/basic.out_ascii
new file mode 100644
index 00000000..40675c67
--- /dev/null
+++ b/regress/roff/shift/basic.out_ascii
@@ -0,0 +1,25 @@
+SHIFT_BASIC(1) General Commands Manual SHIFT_BASIC(1)
+
+
+
+NNAAMMEE
+ sshhiifftt--bbaassiicc - the shift request
+
+DDEESSCCRRIIPPTTIIOONN
+ original arguments: oonnee_t_w_otthhrreeee_f_o_u_rffiivvee
+
+ after shift 2: tthhrreeee_f_o_u_rffiivvee
+
+ after shift without argument: ffoouurr_f_i_v_e
+
+ after shift 0: ffoouurr_f_i_v_e
+
+ expand to less than three bytes: <1>
+
+ expand to exactly three bytes: <x y>
+
+ expand to more than three bytes: <a longer argument... and another>
+
+
+
+OpenBSD August 23, 2018 SHIFT_BASIC(1)