diff options
Diffstat (limited to 'testsuite/sed.tests')
| -rwxr-xr-x | testsuite/sed.tests | 32 |
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 | ||
| 336 | testing "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 | |||
| 342 | testing "sed /regex/,+N{...} addresses work" \ | ||
| 343 | "sed /^2/,+2{d}" \ | ||
| 344 | "1\n5\n" \ | ||
| 345 | "" \ | ||
| 346 | "1\n2\n3\n4\n5\n" | ||
| 347 | |||
| 348 | testing "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 | ||
| 355 | testing "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 | ||
| 362 | testing "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 | ||
| 338 | exit $FAILCOUNT | 370 | exit $FAILCOUNT |
