From af51034338e107f1f45a66547e785b7730d20459 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 24 Mar 2016 16:20:36 -0500 Subject: 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. --- tests/sed.test | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/sed.test') 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" -- cgit v1.2.3