aboutsummaryrefslogtreecommitdiff
path: root/tests/builtin/sed.testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-11-19 18:30:11 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-11-25 14:52:00 +0300
commit18de2b7b5b1b063e7a074878b4e3b3ccdd5c6ebc (patch)
tree36c60d9dd494b1b4cb714fea9900899362273e2f /tests/builtin/sed.testscript
parentae43c5780651d594b1ec76e99330cd6ef082b0c5 (diff)
Allow multiple -e options for sed builtin
Diffstat (limited to 'tests/builtin/sed.testscript')
-rw-r--r--tests/builtin/sed.testscript55
1 files changed, 39 insertions, 16 deletions
diff --git a/tests/builtin/sed.testscript b/tests/builtin/sed.testscript
index ad26483..7fbc9b2 100644
--- a/tests/builtin/sed.testscript
+++ b/tests/builtin/sed.testscript
@@ -89,16 +89,10 @@ test.options += -c
sed: empty script
EOE
- : multiple
- :
- $* -e 's/a//' -e 's/a//' 2>>EOE != 0
- sed: multiple scripts
- EOE
-
: invalid
:
$* -e 'z' 2>>EOE != 0
- sed: only 's' command supported
+ sed: unknown command in 'z': only 's' command supported
EOE
}
@@ -156,13 +150,13 @@ test.options += -c
: none
:
$* -e 's' 2>>EOE != 0
- sed: no delimiter for 's' command
+ sed: no delimiter for 's' command in 's'
EOE
: invalid
:
$* -e 's\\' 2>>EOE != 0
- sed: invalid delimiter for 's' command
+ sed: invalid delimiter for 's' command in 's\\'
EOE
}
@@ -171,14 +165,14 @@ test.options += -c
{
: unterminated
:
- $* -e 's/foo' 2>>/EOE != 0
- sed: unterminated 's' command regex
+ $* -e 's/foo' 2>>EOE != 0
+ sed: unterminated 's' command regex in 's/foo'
EOE
: empty
:
$* -e 's///' 2>>EOE != 0
- sed: empty regex in 's' command
+ sed: empty regex in 's' command in 's///'
EOE
: invalid
@@ -187,20 +181,20 @@ test.options += -c
: regex errors. For example '*' is parsed successfully.
:
$* -e 's/foo[/bar/' 2>>~%EOE% != 0
- %sed: invalid regex.*%
+ %sed: invalid regex 'foo\[' in 's/foo\[/bar/'.*%
EOE
}
: unterminated-replacement
:
- $* -e 's/foo/bar' 2>>/EOE != 0
- sed: unterminated 's' command replacement
+ $* -e 's/foo/bar' 2>>EOE != 0
+ sed: unterminated 's' command replacement in 's/foo/bar'
EOE
: invalid-flags
:
$* -e 's/foo/bar/a' 2>>EOE != 0
- sed: invalid 's' command flag 'a'
+ sed: invalid 's' command flag 'a' in 's/foo/bar/a'
EOE
}
@@ -314,6 +308,35 @@ test.options += -c
}
}
}
+
+ : multiple
+ :
+ {
+ $* -e 's/b/x/' -e 's/x/y/' -e 's/c/z/' <'abc' >'ayz' : replace-replacement
+
+ : new-cycle
+ :
+ $* -e 's/b/x/p' -e 's/x/y/p' <<EOI >>EOO
+ abc
+ klm
+ dxe
+ EOI
+ axc
+ klm
+ dye
+ EOO
+
+ : quiet
+ :
+ $* -n -e 's/b/x/p' -e 's/x/y/p' <<EOI >>EOO
+ abc
+ klm
+ dxe
+ EOI
+ axc
+ dye
+ EOO
+ }
}
: in-place