From 18de2b7b5b1b063e7a074878b4e3b3ccdd5c6ebc Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 19 Nov 2020 18:30:11 +0300 Subject: Allow multiple -e options for sed builtin --- tests/builtin/sed.testscript | 55 +++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 16 deletions(-) (limited to 'tests') 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' <>EOO + abc + klm + dxe + EOI + axc + klm + dye + EOO + + : quiet + : + $* -n -e 's/b/x/p' -e 's/x/y/p' <>EOO + abc + klm + dxe + EOI + axc + dye + EOO + } } : in-place -- cgit v1.1