summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2018-07-09 13:07:10 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2018-07-09 13:07:10 +0000
commitf39824230b81232a12451ad72b5985e9fa144caf (patch)
tree414f6ec9ae6431468a36eab88fb4fb6bb788893f
parenta8b088af2940490a9c39f2006e54bd9743c30d6e (diff)
catch up with compile.c rev. 1.48; while here, also add tests for
those unusual delimiter characters that did *not* change behaviour
-rw-r--r--regress/usr.bin/sed/sedtest.expected224
-rw-r--r--regress/usr.bin/sed/sedtest.sh29
2 files changed, 212 insertions, 41 deletions
diff --git a/regress/usr.bin/sed/sedtest.expected b/regress/usr.bin/sed/sedtest.expected
index 4d129a02936..21d2b8cd897 100644
--- a/regress/usr.bin/sed/sedtest.expected
+++ b/regress/usr.bin/sed/sedtest.expected
@@ -4503,7 +4503,7 @@ XYeYff
XYeYYf
XYeYYY
XYeYYY
-[ as an s delimiter and its escapes
+various special characters as delimiters
=============
Test 8.17:186
@@ -4526,46 +4526,208 @@ l1X14
=============
Test 8.18:187
=============
-X_1
-X_2
-X_3
-X_4
-X_5
-X_6
-X_7
-X_8
-X_9
-X_10
-X_11
-X_12
-X_13
-X_14
+l1_$R
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_1$R
+l1_12
+l1_13
+l1_14
=============
Test 8.19:188
=============
-X[_1
-X[_2
-X[_3
-X[_4
-X[_5
-X[_6
-X[_7
-X[_8
-X[_9
-X[_10
-X[_11
-X[_12
-X[_13
-X[_14
-\ in y command
+l1_1
+l1_2
+l1_(3)
+l1_4
+l1_(5)
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_12
+l1_1(3)
+l1_14
=============
Test 8.20:189
=============
-a-b-c
+l1*R
+l1*R2
+l1*R3
+l1*R4
+l1*R5
+l1*R6
+l1*R7
+l1*R8
+l1*R9
+l1*R0
+l1*R
+l1*R2
+l1*R3
+l1*R4
=============
Test 8.21:190
=============
+l1+R
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1+R0
+l1+R
+l1+R2
+l1+R3
+l1+R4
+
+=============
+Test 8.22:191
+=============
+lR.1
+lR.2
+lR.3
+lR.4
+lR.5
+lR.6
+lR.7
+lR.8
+lR.9
+lR.R.
+lR.R.
+lR.R.
+lR.R.
+lR.R.
+
+=============
+Test 8.23:192
+=============
+l1R
+l1/2
+l1/3
+l1/4
+l1/5
+l1/6
+l1/7
+l1/8
+l1/9
+l1R0
+l1R1
+l1R2
+l1R3
+l1R4
+
+=============
+Test 8.24:193
+=============
+l1?R
+l1?R2
+l1?R3
+l1?R4
+l1?R5
+l1?R6
+l1?R7
+l1?R8
+l1?R9
+l1?R0
+l1?R1
+l1?R2
+l1?R3
+l1?R4
+
+=============
+Test 8.25:194
+=============
+l1_1
+l1_[R]
+l1_[R]
+l1_[R]
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_1[R]
+l1_1[R]
+l1_1[R]
+
+=============
+Test 8.26:195
+=============
+R^1_1
+R^1_2
+R^1_3
+R^1_4
+R^1_5
+R^1_6
+R^1_7
+R^1_8
+R^1_9
+R^1_10
+R^1_11
+R^1_12
+R^1_13
+R^1_14
+
+=============
+Test 8.27:196
+=============
+l1_1
+l1_2
+l1_3
+l1_4
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_{R}
+l1_12
+l1_13
+l1_14
+
+=============
+Test 8.28:197
+=============
+l1_1
+l1_|R
+l1_3
+l1_|R
+l1_5
+l1_6
+l1_7
+l1_8
+l1_9
+l1_10
+l1_11
+l1_1|R
+l1_13
+l1_1|R
+\ in y command
+
+=============
+Test 8.29:198
+=============
+a-b-c
+
+=============
+Test 8.30:199
+=============
z
diff --git a/regress/usr.bin/sed/sedtest.sh b/regress/usr.bin/sed/sedtest.sh
index 0efc342fe05..c226ee5012f 100644
--- a/regress/usr.bin/sed/sedtest.sh
+++ b/regress/usr.bin/sed/sedtest.sh
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $OpenBSD: sedtest.sh,v 1.6 2016/10/11 19:31:15 martijn Exp $
+# $OpenBSD: sedtest.sh,v 1.7 2018/07/09 13:07:09 schwarze Exp $
#
# Copyright (c) 1992 Diomidis Spinellis.
# Copyright (c) 1992, 1993
@@ -408,19 +408,28 @@ u2/g' lines1
mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
mark '8.16'
echo 'eeefff' | $SED -e 'p' -e 's/e/X/p' -e ':x' -e 's//Y/p' -e '/f/bx'
- echo '[ as an s delimiter and its escapes'
+ echo 'various special characters as delimiters'
+# POSIX says "Within the BRE and the replacement, the BRE delimiter itself
+# can be used as a literal character if it is preceded by a <backslash>".
+# That is an ambiguous statement. We interpret it in the sense that the
+# character is passed on literally to the RE engine, without the backslash.
mark '8.17' ; $SED -e 's[_[X[' lines1
-# This is a matter of interpretation
-# POSIX 1003.1, 2004 says "Within the BRE and the replacement,
-# the BRE delimiter itself can be used as a *literal* character
-# if it is preceded by a backslash
- mark '8.18' ; sed 's/l/[/' lines1 | $SED -e 's[\[.[X['
- mark '8.19' ; sed 's/l/[/' lines1 | $SED -e 's[\[.[X\[['
+ mark '8.18' ; $SED -e 's$1\$$\$R$' lines1
+ mark '8.19' ; $SED -Ee 's(\(3|5)(\(\1)(' lines1
+ mark '8.20' ; $SED -e 's*_1\**\*R*' lines1
+ mark '8.21' ; $SED -Ee 's+_1\++\+R+' lines1
+ mark '8.22' ; $SED -e 's.1\..R\..g' lines1
+ mark '8.23' ; sed 's/_/\//' lines1 | $SED -e 's/\/1/R/'
+ mark '8.24' ; $SED -Ee 's?_1\??\?R?' lines1
+ mark '8.25' ; $SED -e 's[\[2-4][\[R][' lines1
+ mark '8.26' ; $SED -e 's^\^l^R\^^' lines1
+ mark '8.27' ; $SED -Ee 's{1\{2}{\{R}{' lines1
+ mark '8.28' ; $SED -Ee 's|2\|4|\|R|' lines1
echo '\ in y command'
- mark '8.20'
+ mark '8.29'
printf 'a\\b(c\n' |
$SED 'y%ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"%abcdefghijklmnopqrstuvwxyz,------%'
- mark '8.21'
+ mark '8.30'
# Test if an unmatched line is only printed once.
printf 'z\n' | $SED -e 's/^a*/b/2p'
}