sed: fix sed -i: unlike without -i, it does not forget ranges
[oweals/busybox.git] / testsuite / sed.tests
index 3301a25f8fc42f5c1e4b36297d8ccf8e4ecf39e3..445eff6bc6041c2278e05605e2379a64d41e7934 100755 (executable)
@@ -270,11 +270,16 @@ 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"
 
+testing "sed -i with address modifies all files, not only first" \
+       "cp input input2; sed -i -e '1s/foo/bar/' input input2 && cat input input2; rm input2" \
+       "bar\nbar\n" "foo\n" "foo\n"
+
+
 # testing "description" "arguments" "result" "infile" "stdin"
 
 exit $FAILCOUNT