aboutsummaryrefslogtreecommitdiff
path: root/tests/sed.test
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-11-14 16:44:21 -0600
committerRob Landley <rob@landley.net>2014-11-14 16:44:21 -0600
commit1d5f48f3c195fbd9907cbbf89250c3a5ba6c4389 (patch)
treed7ff3d2ccba896a1413ab2fd9cc35d517b1bc3b3 /tests/sed.test
parent9dbcee4875c71afbaf0df42f8e5ce3b6533d6c14 (diff)
downloadtoybox-1d5f48f3c195fbd9907cbbf89250c3a5ba6c4389.tar.gz
Add a few more sed tests.
Diffstat (limited to 'tests/sed.test')
-rw-r--r--tests/sed.test23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/sed.test b/tests/sed.test
index 020759bd..7ac5e887 100644
--- a/tests/sed.test
+++ b/tests/sed.test
@@ -39,8 +39,7 @@ testing 'sed match t delim makes \t literal t' \
"sed -n '\t\txtp'" "tx\n" "" "tx\n"
testing 'sed match n delim' "sed -n '\n\txnp'" "\tx\n" "" "\tx\n"
testing 'sed match n delim disables \n newline' "sed -n '\n\nxnp'" "" "" "\nx\n"
-testing 'sed match n delim makes \n literal n' \
- "sed -n '\n\nxnp'" "nx\n" "" "nx\n"
+SKIP_HOST=1 testing 'sed match \n literal n' "sed -n '\n\nxnp'" "nx\n" "" "nx\n"
testing 'end match does not check starting match line' \
"sed -n '/two/,/two/p'" "two\nthree" "" "one\ntwo\nthree"
testing 'end match/start match mixing number/letter' \
@@ -63,3 +62,23 @@ testing 'sed newline staying away' 'sed s/o/x/' 'xne\ntwx' '' 'one\ntwo'
testing 'sed what, _really_?' 'sed -e a\\ && echo yes really' \
'one\nyes really\n' '' 'one\n'
+# all the s/// test
+
+
+testing 'sed \1' "sed 's/t\\(w\\)o/za\\1py/'" "one\nzawpy\nthree" "" \
+ "one\ntwo\nthree"
+testing 'sed \1 p' "sed 's/t\\(w\\)o/za\\1py/p'" "one\nzawpy\nzawpy\nthree" \
+ "" "one\ntwo\nthree"
+testing 'sed \1 no newline' "sed 's/t\\(w\\)o/za\\1py/'" "one\nzawpy" "" \
+ "one\ntwo"
+testing 'sed \1 p no newline' "sed 's/t\\(w\\)o/za\\1py/p'" \
+ "one\nzawpy\nzawpy" "" "one\ntwo"
+testing 'sed -n s//\1/p' "sed -n 's/t\\(w\\)o/za\\1py/p'" "zawpy" "" "one\ntwo"
+testing 'sed -n s//\1/p no newline' "sed -n 's/t\\(w\\)o/za\\1py/p'" "zawpy" \
+ "" "one\ntwo"
+testing 'sed backref error' "sed 's/w/ale \2 ha/' 2>/dev/null || echo no" \
+ "no\n" "" "one\ntwo\nthree"
+testing 'sed empty match after nonempty match' "sed -e 's/a*/c/g'" 'cbcncgc' \
+ '' 'baaang'
+testing 'sed empty match' "sed -e 's/[^ac]*/A/g'" 'AaAcA' '' 'abcde'
+