From 8132ad2f4ec9b463ed954a302e9e490b549b106a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 29 Oct 2015 01:30:58 -0500 Subject: Fix sed bug reported by Isabella Parakiss, where sed -e "/x/c\" -e "y" added an extra newline because the test for whether we have an existing string to append a newline to was checking if struct step had data appended to it, and the /x/ regex is data appended to it. Change test to check for null terminator at ->arg1 offset. --- tests/sed.test | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/sed.test') diff --git a/tests/sed.test b/tests/sed.test index 9f2956f8..56d68fdb 100755 --- a/tests/sed.test +++ b/tests/sed.test @@ -127,6 +127,9 @@ testing "" "sed -e '1a\' -e 'huh'" "meep\nhuh\n" "" "meep" testing "" "sed -f input" "blah\nboom\n" '1a\\\nboom' 'blah' testing "" "sed '1a\ hello'" "merp\nhello\n" "" "merp" + +testing "" "sed -e '/x/c\' -e 'y'" 'y\n' '' 'x\n' + #echo meep | sed/sed -e '1a\' -e 'huh' #echo blah | sed/sed -f <(echo -e "1a\\\\\nboom") #echo merp | sed/sed "1a\\ -- cgit v1.2.3