summaryrefslogtreecommitdiff
path: root/regress/usr.bin/grep
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2023-11-15 00:52:43 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2023-11-15 00:52:43 +0000
commita972a9c8e353259ff2e8afc7c9fb1dc5f4aaca97 (patch)
tree1197b33f8ec563ebd45488af357f1662c37fad41 /regress/usr.bin/grep
parent21ae7445de6d85929d63d7058dc60fa106e1fa55 (diff)
Add regress test for "grep -m" behavior. From Crystal Kolipe.
Diffstat (limited to 'regress/usr.bin/grep')
-rw-r--r--regress/usr.bin/grep/Makefile25
-rw-r--r--regress/usr.bin/grep/t28.in7
2 files changed, 29 insertions, 3 deletions
diff --git a/regress/usr.bin/grep/Makefile b/regress/usr.bin/grep/Makefile
index edb5a524817..8b227fff73a 100644
--- a/regress/usr.bin/grep/Makefile
+++ b/regress/usr.bin/grep/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.18 2021/12/29 19:31:01 sdk Exp $
+# $OpenBSD: Makefile,v 1.19 2023/11/15 00:52:42 millert Exp $
REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 \
- t18 t19 t20 t21 t22 t23 t24 t25 t26 t27
+ t18 t19 t20 t21 t22 t23 t24 t25 t26 t27 t28
t1:
grep t.s ${.CURDIR}/in | diff - ${.CURDIR}/t1.out
@@ -107,8 +107,27 @@ t27:
grep -B1 'C' ${.CURDIR}/t27.in | diff - ${.CURDIR}/t27b.out
grep -C1 'C' ${.CURDIR}/t27.in | diff - ${.CURDIR}/t27c.out
+t28:
+ grep -m 0 -o x.y ${.CURDIR}/t28.in | diff - /dev/null
+ grep -m 1 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_1.out
+ grep -m 2 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_2.out
+ grep -m 3 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_3.out
+ grep -m 4 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out
+ grep -m 5 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out
+ grep -m 6 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out
+ grep -m 7 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out
+ grep -m 8 -o x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_4.out
+ grep -m 0 x.y ${.CURDIR}/t28.in | diff - /dev/null
+ grep -m 1 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_5.out
+ grep -m 2 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_6.out
+ grep -m 3 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_7.out
+ grep -m 4 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out
+ grep -m 5 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out
+ grep -m 6 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out
+ grep -m 7 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out
+ grep -m 8 x.y ${.CURDIR}/t28.in | diff - ${.CURDIR}/t28_8.out
.PHONY: t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20
-.PHONY: t21 t22 t23 t24 t25 t26 t27
+.PHONY: t21 t22 t23 t24 t25 t26 t27 t28
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/grep/t28.in b/regress/usr.bin/grep/t28.in
new file mode 100644
index 00000000000..1a5a9915390
--- /dev/null
+++ b/regress/usr.bin/grep/t28.in
@@ -0,0 +1,7 @@
+regression test pattern should match nothing on this line
+x1y x2y x3y x4y - four matches here
+match nothing on this line
+x5y x6y x7y - three here
+x8y x9y - two here
+x0y - one here
+none here