[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] testsuite: sed testcase with replace on multiple files
From:       Natanael Copa <natanael.copa () gmail ! com>
Date:       2010-07-30 14:53:54
Message-ID: 1280502039-20745-1-git-send-email-natanael.copa () gmail ! com
[Download RAW message or body]

Currently there is a bug in sed that makes it only replace first
file when an "address" is specified:

 sed -i -e '1{s/foo/bar/}' one two

Will only replace 'one' and not 'two'.
---
 testsuite/sed.tests |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/testsuite/sed.tests b/testsuite/sed.tests
index 3301a25..20ecd54 100755
--- a/testsuite/sed.tests
+++ b/testsuite/sed.tests
@@ -270,11 +270,19 @@ testing "sed a cmd ended by double backslash" \
 	| two \\
 '
 
-# fisrt three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges
+# first three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges
 testing "sed with N skipping lines past ranges on next cmds" \
 	"sed -n '1{N;N;d};1p;2,3p;3p;4p'" \
 	"4\n4\n" "" "1\n2\n3\n4\n"
 
+$ECHO "foo" > sed.one 
+$ECHO "foo" > sed.two
+testing "sed with address modifies all files not only first" \
+	"sed -i -e '1s/foo/bar/' sed.one sed.two && cat sed.one sed.two" \
+	"bar\nbar\n" "" ""
+rm -f sed.one sed.two
+
+
 # testing "description" "arguments" "result" "infile" "stdin"
 
 exit $FAILCOUNT
-- 
1.7.2.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic