Add test for for the case where the pattern space is empty but does
authormillert <millert@openbsd.org>
Wed, 28 Aug 2024 14:32:02 +0000 (14:32 +0000)
committermillert <millert@openbsd.org>
Wed, 28 Aug 2024 14:32:02 +0000 (14:32 +0000)
not start with a NUL character, which might occur after using the
D command.

regress/usr.bin/sed/Makefile
regress/usr.bin/sed/commandD2.expected [new file with mode: 0644]
regress/usr.bin/sed/commandD2.sed [new file with mode: 0644]

index 02e6b05..84ef3b3 100644 (file)
@@ -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 <bsd.regress.mk>
diff --git a/regress/usr.bin/sed/commandD2.expected b/regress/usr.bin/sed/commandD2.expected
new file mode 100644 (file)
index 0000000..b8f34f1
--- /dev/null
@@ -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 (file)
index 0000000..27580bd
--- /dev/null
@@ -0,0 +1 @@
+s/^//p;$!N;D