aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-04-17 14:24:55 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-04-17 14:24:55 +0200
commit63f4d32c9859c1ed341debefddad4b9c0ae944cc (patch)
treef386542a9330a9b480519d94779e0e6caf2664dd /testsuite
parent71a5b67ba0339265153217df646827a1213e03f5 (diff)
downloadbusybox-w32-63f4d32c9859c1ed341debefddad4b9c0ae944cc.tar.gz
busybox-w32-63f4d32c9859c1ed341debefddad4b9c0ae944cc.tar.bz2
busybox-w32-63f4d32c9859c1ed341debefddad4b9c0ae944cc.zip
sed: implement ",+N" range end
function old new delta add_cmd 1115 1173 +58 process_files 2226 2253 +27 sed_main 696 702 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 91/0) Total: 91 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/sed.tests32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/sed.tests b/testsuite/sed.tests
index 19f2915ce..34479e55f 100755
--- a/testsuite/sed.tests
+++ b/testsuite/sed.tests
@@ -333,6 +333,38 @@ testing "sed s///NUM test" \
333 "sed -e 's/a/b/2; s/a/c/g'" \ 333 "sed -e 's/a/b/2; s/a/c/g'" \
334 "cb\n" "" "aa\n" 334 "cb\n" "" "aa\n"
335 335
336testing "sed /regex/,N{...} addresses work" \
337 "sed /^2/,2{d}" \
338 "1\n3\n4\n5\n" \
339 "" \
340 "1\n2\n3\n4\n5\n"
341
342testing "sed /regex/,+N{...} addresses work" \
343 "sed /^2/,+2{d}" \
344 "1\n5\n" \
345 "" \
346 "1\n2\n3\n4\n5\n"
347
348testing "sed /regex/,+N{...} -i works" \
349 "cat - >input2; sed /^4/,+2{d} -i input input2; echo \$?; cat input input2; rm input2" \
350 "0\n""1\n2\n3\n7\n8\n""1\n2\n7\n8\n" \
351 "1\n2\n3\n4\n5\n6\n7\n8\n" \
352 "1\n2\n4\n5\n6\n7\n8\n" \
353
354# GNU sed 4.2.1 would also accept "/^4/,+{d}" with the same meaning, we don't
355testing "sed /regex/,+0{...} -i works" \
356 "cat - >input2; sed /^4/,+0{d} -i input input2; echo \$?; cat input input2; rm input2" \
357 "0\n""1\n2\n3\n5\n6\n7\n8\n""1\n2\n5\n6\n7\n8\n" \
358 "1\n2\n3\n4\n5\n6\n7\n8\n" \
359 "1\n2\n4\n5\n6\n7\n8\n" \
360
361# GNU sed 4.2.1 would also accept "/^4/,+d" with the same meaning, we don't
362testing "sed /regex/,+0<cmd> -i works" \
363 "cat - >input2; sed /^4/,+0d -i input input2; echo \$?; cat input input2; rm input2" \
364 "0\n""1\n2\n3\n5\n6\n7\n8\n""1\n2\n5\n6\n7\n8\n" \
365 "1\n2\n3\n4\n5\n6\n7\n8\n" \
366 "1\n2\n4\n5\n6\n7\n8\n" \
367
336# testing "description" "commands" "result" "infile" "stdin" 368# testing "description" "commands" "result" "infile" "stdin"
337 369
338exit $FAILCOUNT 370exit $FAILCOUNT