diff options
author | Rob Landley <rob@landley.net> | 2016-03-24 16:20:36 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-03-24 16:20:36 -0500 |
commit | af51034338e107f1f45a66547e785b7730d20459 (patch) | |
tree | 4bd0f5294710bd90562e3ea79f9f7c32309383d8 /tests | |
parent | 1ffa7f45eb4fe3b73f94e69c929ad311d9c44b81 (diff) | |
download | toybox-af51034338e107f1f45a66547e785b7730d20459.tar.gz |
Debian bug 635570 did something horribly nonstandard (depending on a side
effect of "sed -e 'a\'" with no trailing line). But there's an actual user,
and it's not hard to implement, and it's not hard to implement, and there
isn't an obvious _other_ way to do it, so add the behavior and a test for it.
Fix some bad/missing comments while I was there, and add a couple TODOs.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/sed.test | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/sed.test b/tests/sed.test index b308b699..7a4a8cda 100755 --- a/tests/sed.test +++ b/tests/sed.test @@ -77,9 +77,7 @@ testing "c {range}" "sed -e '2,4{c blah' -e '}'" \ "" "one\ntwo\nthree\nfour\nfive\nsix" testing "c multiple continuation" \ "sed -e 'c\\' -e 'two\\' -e ''" "two\n\n" "" "hello" -# NOTE: will print 'unfinished c' to stderr and exit 1 -testing "c empty continuation" \ - "sed -e 'c\\'" "" "" "hello" +SKIP_HOST=1 testing "c empty continuation" "sed -e 'c\\'" "\n" "" "hello" testing "D further processing depends on whether line is blank" \ "sed -e '/one/,/three/{' -e 'i meep' -e'N;2D;}'" \ "meep\nmeep\ntwo\nthree\n" "" "one\ntwo\nthree\n" @@ -138,6 +136,12 @@ testing "" "sed 'y/a\\bc/de\f/'" "db\f" "" "abc" testing "[a-a] (for perl)" "sed '"'s/\([^a-zA-Z0-9.:_\-\/]\)/\\\1/g'"'" \ 'he\ llo' "" "he llo" +# Debian bug https://bugs.debian.org/635570 added code to ensure a file +# ends with a newline via "sed -e '$a\'". Apparently all a\ with no additional +# pattern lines after it does (other than making posix throw up) is +# flush the pending newline as _if_ it had added another line. *shrug* Ok? +testing "trailing a\ (for debian)" "sed 'a\\'" "hello\n" "" "hello" + # You have to match the first line of a range in order to activate # the range, numeric and ascii work the same way testing "skip start of range" "sed -e n -e '1,2s/b/c/'" "a\nb\n" "" "a\nb\n" |