summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorfanf <fanf@FreeBSD.org>2003-06-04 15:26:23 +0000
committerfanf <fanf@FreeBSD.org>2003-06-04 15:26:23 +0000
commitdc25e19e710fffd27cd06411dfa5918322ca8be7 (patch)
tree3ef69f9547734730159ff3cdd34429dd1169365d /tools
parent4bb0c351d9fd29ede6adb91a6e7146ef0e33a32a (diff)
downloadFreeBSD-src-dc25e19e710fffd27cd06411dfa5918322ca8be7.zip
FreeBSD-src-dc25e19e710fffd27cd06411dfa5918322ca8be7.tar.gz
Add tests for the behaviour of substitution when the regex can match
a zero-length string. This shows bugs in the s///g and s///2+ cases.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/usr.bin/sed/regress.s3.out1
-rw-r--r--tools/regression/usr.bin/sed/regress.s4.out1
-rw-r--r--tools/regression/usr.bin/sed/regress.s5.out1
-rw-r--r--tools/regression/usr.bin/sed/regress.sg.out1
-rw-r--r--tools/regression/usr.bin/sed/regress.sh4
5 files changed, 8 insertions, 0 deletions
diff --git a/tools/regression/usr.bin/sed/regress.s3.out b/tools/regression/usr.bin/sed/regress.s3.out
new file mode 100644
index 0000000..68dfa9b
--- /dev/null
+++ b/tools/regression/usr.bin/sed/regress.s3.out
@@ -0,0 +1 @@
+fo,o
diff --git a/tools/regression/usr.bin/sed/regress.s4.out b/tools/regression/usr.bin/sed/regress.s4.out
new file mode 100644
index 0000000..03914ba
--- /dev/null
+++ b/tools/regression/usr.bin/sed/regress.s4.out
@@ -0,0 +1 @@
+foo,
diff --git a/tools/regression/usr.bin/sed/regress.s5.out b/tools/regression/usr.bin/sed/regress.s5.out
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/tools/regression/usr.bin/sed/regress.s5.out
@@ -0,0 +1 @@
+foo
diff --git a/tools/regression/usr.bin/sed/regress.sg.out b/tools/regression/usr.bin/sed/regress.sg.out
new file mode 100644
index 0000000..7b24f2c
--- /dev/null
+++ b/tools/regression/usr.bin/sed/regress.sg.out
@@ -0,0 +1 @@
+,f,o,o,
diff --git a/tools/regression/usr.bin/sed/regress.sh b/tools/regression/usr.bin/sed/regress.sh
index 15ab0e6..fc5a135 100644
--- a/tools/regression/usr.bin/sed/regress.sh
+++ b/tools/regression/usr.bin/sed/regress.sh
@@ -7,5 +7,9 @@ REGRESSION_TEST(`P', `sed P < regress.in')
REGRESSION_TEST(`psl', `sed \$!g\;P\;D < regress.in')
REGRESSION_TEST(`bcb', `sed s/X/$(jot -n -bx -s "" 2043)\\\\zz/ < regress.in')
REGRESSION_TEST(`y', `echo -n foo | sed y/o/O/')
+REGRESSION_TEST(`sg', `echo foo | sed s/,*/,/g')
+REGRESSION_TEST(`s3', `echo foo | sed s/,*/,/3')
+REGRESSION_TEST(`s4', `echo foo | sed s/,*/,/4')
+REGRESSION_TEST(`s5', `echo foo | sed s/,*/,/5')
REGRESSION_END()
OpenPOWER on IntegriCloud