From 141b108e00b06c20bfa9167f6faaa9419dbb87c4 Mon Sep 17 00:00:00 2001 From: millert Date: Wed, 28 Aug 2024 14:32:02 +0000 Subject: [PATCH] Add test for for the case where the pattern space is empty but does not start with a NUL character, which might occur after using the D command. --- regress/usr.bin/sed/Makefile | 9 +++++++-- regress/usr.bin/sed/commandD2.expected | 3 +++ regress/usr.bin/sed/commandD2.sed | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 regress/usr.bin/sed/commandD2.expected create mode 100644 regress/usr.bin/sed/commandD2.sed diff --git a/regress/usr.bin/sed/Makefile b/regress/usr.bin/sed/Makefile index 02e6b0580ae..84ef3b3a975 100644 --- a/regress/usr.bin/sed/Makefile +++ b/regress/usr.bin/sed/Makefile @@ -1,10 +1,11 @@ -# $OpenBSD: Makefile,v 1.8 2022/01/12 15:32:15 martijn Exp $ +# $OpenBSD: Makefile,v 1.9 2024/08/28 14:32:02 millert Exp $ # $NetBSD: Makefile,v 1.1 2005/04/04 16:48:45 peter Exp $ SED?= /usr/bin/sed REGRESS_TARGETS= sedtest substitute hanoi math sierpinski negation \ - inplace inplace2 inplace3 commandl1 commandl2 commandc1 commandD1 + inplace inplace2 inplace3 commandl1 commandl2 commandc1 commandD1 \ + commandD2 commandc1: # New tests, currently failing, need fixes in sed. @@ -64,6 +65,10 @@ commandD1: printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out diff ${.CURDIR}/$@.expected $@.out +commandD2: + printf 'a\nbb\n\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out + diff ${.CURDIR}/$@.expected $@.out + CLEANFILES+=*.out lines* script* *.txt .include diff --git a/regress/usr.bin/sed/commandD2.expected b/regress/usr.bin/sed/commandD2.expected new file mode 100644 index 00000000000..b8f34f152ac --- /dev/null +++ b/regress/usr.bin/sed/commandD2.expected @@ -0,0 +1,3 @@ +a +bb + diff --git a/regress/usr.bin/sed/commandD2.sed b/regress/usr.bin/sed/commandD2.sed new file mode 100644 index 00000000000..27580bd70e4 --- /dev/null +++ b/regress/usr.bin/sed/commandD2.sed @@ -0,0 +1 @@ +s/^//p;$!N;D -- 2.20.1