Module Name:    src
Committed By:   gutteridge
Date:           Sat May  6 02:12:11 UTC 2023

Modified Files:
        src/tests/usr.bin/sed: t_sed.sh

Log Message:
t_sed.sh: add a test case for relative addressing

At one time, this didn't always work correctly, per PR bin/49109. Test
case from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192108


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/sed/t_sed.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/sed/t_sed.sh
diff -u src/tests/usr.bin/sed/t_sed.sh:1.10 src/tests/usr.bin/sed/t_sed.sh:1.11
--- src/tests/usr.bin/sed/t_sed.sh:1.10	Sat May  6 02:07:42 2023
+++ src/tests/usr.bin/sed/t_sed.sh	Sat May  6 02:12:11 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_sed.sh,v 1.10 2023/05/06 02:07:42 gutteridge Exp $
+# $NetBSD: t_sed.sh,v 1.11 2023/05/06 02:12:11 gutteridge Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -175,6 +175,16 @@ escapes_in_re_bracket_body() {
 		-x 'echo "foo\\d88bar" | sed -e "s/[\d88]/ /g"'
 }
 
+atf_test_case relative_addressing
+relative_addressing_head() {
+	atf_set "descr" "Test that sed(1) handles relative addressing " \
+		"properly (PR bin/49109)"
+}
+
+relative_addressing_body() {
+	atf_check -o match:"3" -x 'seq 1 4 | sed -n "1,+2p" | wc -l'
+}
+
 atf_init_test_cases() {
 	atf_add_test_case c2048
 	atf_add_test_case emptybackref
@@ -184,4 +194,5 @@ atf_init_test_cases() {
 	atf_add_test_case escapes_in_subst
 	atf_add_test_case escapes_in_re
 	atf_add_test_case escapes_in_re_bracket
+	atf_add_test_case relative_addressing
 }

Reply via email to