1*cf5a6c84SAndroid Build Coastguard Worker#!/bin/echo Run scripts/test.sh 2*cf5a6c84SAndroid Build Coastguard Worker 3*cf5a6c84SAndroid Build Coastguard Worker#testing "name" "command" "result" "infile" "stdin" 4*cf5a6c84SAndroid Build Coastguard Worker 5*cf5a6c84SAndroid Build Coastguard Workertestcmd 'as cat' '""' "one\ntwo\nthree" "" "one\ntwo\nthree" 6*cf5a6c84SAndroid Build Coastguard Worker# This segfaults ubuntu 12.04's sed. No really. 7*cf5a6c84SAndroid Build Coastguard Workertestcmd '- - twice' '"" - -' "hello\n" "" "hello\n" 8*cf5a6c84SAndroid Build Coastguard Workertestcmd '-n' '-n ""' "" "" "one\ntwo\nthree" 9*cf5a6c84SAndroid Build Coastguard Workertestcmd '-n p' '-n p' "one\ntwo\nthree" "" "one\ntwo\nthree" 10*cf5a6c84SAndroid Build Coastguard Workertestcmd 'explicit pattern' '-e p -n' "one\ntwo\nthree" "" "one\ntwo\nthree" 11*cf5a6c84SAndroid Build Coastguard Worker 12*cf5a6c84SAndroid Build Coastguard Worker# Exploring the wonders of sed addressing modes 13*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 1p' "one\n" "" "one\ntwo\nthree" 14*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '2p' "one\ntwo\ntwo\nthree" "" "one\ntwo\nthree" 15*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 2p' "two\n" "" "one\ntwo\nthree" 16*cf5a6c84SAndroid Build Coastguard Workertestcmd '-n $p' '-n \$p' "three" "" "one\ntwo\nthree" 17*cf5a6c84SAndroid Build Coastguard Workertestcmd 'as cat #2' "-n '1,\$p'" "one\ntwo\nthree" "" "one\ntwo\nthree" 18*cf5a6c84SAndroid Build Coastguard Workertestcmd 'no input means no last line' "'\$a boing'" "" "" "" 19*cf5a6c84SAndroid Build Coastguard Workertestcmd '-n $,$p' '-n \$,\$p' 'three' '' 'one\ntwo\nthree' 20*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 1,2p' "one\ntwo\n" "" "one\ntwo\nthree" 21*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 2,3p' "two\nthree" "" "one\ntwo\nthree" 22*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 2,1p' "two\n" "" "one\ntwo\nthree" 23*cf5a6c84SAndroid Build Coastguard Workertestcmd '$ with 2 inputs' '-n \$p - input' "four\n" "four\n" "one\ntwo\nthree" 24*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n /two/p' "two\n" "" "one\ntwo\nthree" 25*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 1,/two/p' 'one\ntwo\n' '' 'one\ntwo\nthree' 26*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n /one/,2p' 'one\ntwo\n' '' 'one\ntwo\nthree' 27*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 1,/one/p' 'one\ntwo\nthree' '' 'one\ntwo\nthree' 28*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n /one/,1p' 'one\n' '' 'one\ntwo\nthree' 29*cf5a6c84SAndroid Build Coastguard Workertestcmd '-n /two/,$p' '-n /two/,\$p' 'two\nthree' '' 'one\ntwo\nthree' 30*cf5a6c84SAndroid Build Coastguard Worker 31*cf5a6c84SAndroid Build Coastguard Worker# Fun with newlines! 32*cf5a6c84SAndroid Build Coastguard Workertestcmd '' '-n 3p' "three" "" "one\ntwo\nthree" 33*cf5a6c84SAndroid Build Coastguard Workertestcmd 'prodigal newline' "-n '1,\$p' - input" \ 34*cf5a6c84SAndroid Build Coastguard Worker "one\ntwo\nthree\nfour\n" "four\n" "one\ntwo\nthree" 35*cf5a6c84SAndroid Build Coastguard Workertestcmd 'Newline only added if further output' "-n 3p - input" "three" \ 36*cf5a6c84SAndroid Build Coastguard Worker "four\n" "one\ntwo\nthree" 37*cf5a6c84SAndroid Build Coastguard Worker 38*cf5a6c84SAndroid Build Coastguard Worker# Fun with match delimiters and escapes 39*cf5a6c84SAndroid Build Coastguard Workertestcmd 'match \t tab' "-n '/\t/p'" "\tx\n" "" "\tx\n" 40*cf5a6c84SAndroid Build Coastguard Workertestcmd 'match t delim disables \t tab' "-n '\t\txtp'" "" "" "\tx\n" 41*cf5a6c84SAndroid Build Coastguard Workertestcmd 'match t delim makes \t literal t' "-n '\t\txtp'" "tx\n" "" "tx\n" 42*cf5a6c84SAndroid Build Coastguard Workertestcmd 'match n delim' "-n '\n\txnp'" "\tx\n" "" "\tx\n" 43*cf5a6c84SAndroid Build Coastguard Workertestcmd 'match n delim disables \n newline' "-n '\n\nxnp'" "" "" "\nx\n" 44*cf5a6c84SAndroid Build Coastguard Workertoyonly testcmd 'match \n literal n' "-n '\n\nxnp'" "nx\n" "" "nx\n" 45*cf5a6c84SAndroid Build Coastguard Workertestcmd 'end match does not check starting match line' \ 46*cf5a6c84SAndroid Build Coastguard Worker "-n '/two/,/two/p'" "two\nthree" "" "one\ntwo\nthree" 47*cf5a6c84SAndroid Build Coastguard Workertestcmd 'end match/start match mixing number/letter' \ 48*cf5a6c84SAndroid Build Coastguard Worker "-n '2,/two/p'" "two\nthree" "" "one\ntwo\nthree" 49*cf5a6c84SAndroid Build Coastguard Workertestcmd 'num then regex' '-n 2,/d/p' 'b\nc\nd\n' '' 'a\nb\nc\nd\ne\nf\n' 50*cf5a6c84SAndroid Build Coastguard Workertestcmd 'regex then num' '-n /b/,4p' 'b\nc\nd\n' '' 'a\nb\nc\nd\ne\nf\n' 51*cf5a6c84SAndroid Build Coastguard Workertestcmd 'multiple regex address match' '-n /on/,/off/p' \ 52*cf5a6c84SAndroid Build Coastguard Worker 'bone\nturtle\scoff\ntron\nlurid\noffer\n' "" \ 53*cf5a6c84SAndroid Build Coastguard Worker 'zap\nbone\nturtle\scoff\nfred\ntron\nlurid\noffer\nbecause\n' 54*cf5a6c84SAndroid Build Coastguard Workertestcmd 'regex address overlap' '-n /on/,/off/p' "on\nzap\noffon\n" "" \ 55*cf5a6c84SAndroid Build Coastguard Worker 'on\nzap\noffon\nping\noff\n' 56*cf5a6c84SAndroid Build Coastguard Workertestcmd 'getdelim with nested [:blah:]' '-n "sa\a[a[:space:]bc]*aXXagp"' \ 57*cf5a6c84SAndroid Build Coastguard Worker "ABXXCDXXEFXXGHXXIXX" "" "ABaaCDa EFaa aGHa a Ia " 58*cf5a6c84SAndroid Build Coastguard Workertestcmd '[ in [[]' "'s@[[]@X@g'" "X" "" "[" 59*cf5a6c84SAndroid Build Coastguard Workertestcmd '[[] with ] as delimiter' "'s][[]]X]g'" "X" "" "[" 60*cf5a6c84SAndroid Build Coastguard Workertestcmd '[[] with [ as delimiter' "'s[\[\[][X['" "X" "" "[" 61*cf5a6c84SAndroid Build Coastguard Worker 62*cf5a6c84SAndroid Build Coastguard Worker# gGhHlnNpPqrstwxy:= 63*cf5a6c84SAndroid Build Coastguard Worker# s///#comment 64*cf5a6c84SAndroid Build Coastguard Worker# abcdDi 65*cf5a6c84SAndroid Build Coastguard Worker 66*cf5a6c84SAndroid Build Coastguard Workertestcmd 'prodigaler newline' '-e a\\ -e woo' 'one\nwoo\n' '' 'one' 67*cf5a6c84SAndroid Build Coastguard Workertestcmd "aci" "-e '3a boom' -e '/hre/i bang' -e '3a whack' -e '3c bong'" \ 68*cf5a6c84SAndroid Build Coastguard Worker "one\ntwo\nbang\nbong\nboom\nwhack\nfour\n" "" \ 69*cf5a6c84SAndroid Build Coastguard Worker "one\ntwo\nthree\nfour\n" 70*cf5a6c84SAndroid Build Coastguard Workertestcmd "b loop" "':woo;=;b woo' | head -n 5" '1\n1\n1\n1\n1\n' "" "X" 71*cf5a6c84SAndroid Build Coastguard Workertestcmd "b skip" "-n '2b zap;d;:zap;p'" "two\n" "" "one\ntwo\nthree" 72*cf5a6c84SAndroid Build Coastguard Workertestcmd "b end" "-n '2b;p'" "one\nthree" "" "one\ntwo\nthree" 73*cf5a6c84SAndroid Build Coastguard Workertestcmd "c range" "'2,4c blah'" "one\nblah\nfive\nsix" "" \ 74*cf5a6c84SAndroid Build Coastguard Worker "one\ntwo\nthree\nfour\nfive\nsix" 75*cf5a6c84SAndroid Build Coastguard Workertestcmd "c {range}" "-e '2,4{c blah' -e '}'" "one\nblah\nblah\nblah\nfive\nsix"\ 76*cf5a6c84SAndroid Build Coastguard Worker "" "one\ntwo\nthree\nfour\nfive\nsix" 77*cf5a6c84SAndroid Build Coastguard Workertestcmd "c multiple continuation" "-e 'c\\' -e 'two\\' -e ''" "two\n\n" "" \ 78*cf5a6c84SAndroid Build Coastguard Worker "hello" 79*cf5a6c84SAndroid Build Coastguard Workertestcmd 'multiline continuations' '-e c\\ -e line1\\ -e line2' 'line1\nline2\n'\ 80*cf5a6c84SAndroid Build Coastguard Worker '' 'one\n' 81*cf5a6c84SAndroid Build Coastguard Workertoyonly testing "c empty continuation" "sed -e 'c\\'" "\n" "" "hello" 82*cf5a6c84SAndroid Build Coastguard Workertesting "D further processing depends on whether line is blank" \ 83*cf5a6c84SAndroid Build Coastguard Worker "sed -e '/one/,/three/{' -e 'i meep' -e'N;2D;}'" \ 84*cf5a6c84SAndroid Build Coastguard Worker "meep\nmeep\ntwo\nthree\n" "" "one\ntwo\nthree\n" 85*cf5a6c84SAndroid Build Coastguard Workertesting 'newline staying away' 'sed s/o/x/' 'xne\ntwx' '' 'one\ntwo' 86*cf5a6c84SAndroid Build Coastguard Worker 87*cf5a6c84SAndroid Build Coastguard Worker# Why on _earth_ is this not an error? There's a \ with no continuation! 88*cf5a6c84SAndroid Build Coastguard Worker#testing 'sed what, _really_?' 'sed -e a\\ && echo yes really' \ 89*cf5a6c84SAndroid Build Coastguard Worker# 'one\nyes really\n' '' 'one\n' 90*cf5a6c84SAndroid Build Coastguard Worker 91*cf5a6c84SAndroid Build Coastguard Worker# all the s/// test 92*cf5a6c84SAndroid Build Coastguard Worker 93*cf5a6c84SAndroid Build Coastguard Workertesting "match empty line" "sed -e 's/^\$/@/'" "@\n" "" "\n" 94*cf5a6c84SAndroid Build Coastguard Worker 95*cf5a6c84SAndroid Build Coastguard Workertesting '\1' "sed 's/t\\(w\\)o/za\\1py/'" "one\nzawpy\nthree" "" \ 96*cf5a6c84SAndroid Build Coastguard Worker "one\ntwo\nthree" 97*cf5a6c84SAndroid Build Coastguard Workertesting '\1 p' "sed 's/t\\(w\\)o/za\\1py/p'" "one\nzawpy\nzawpy\nthree" \ 98*cf5a6c84SAndroid Build Coastguard Worker "" "one\ntwo\nthree" 99*cf5a6c84SAndroid Build Coastguard Workertesting '\1 no newline' "sed 's/t\\(w\\)o/za\\1py/'" "one\nzawpy" "" \ 100*cf5a6c84SAndroid Build Coastguard Worker "one\ntwo" 101*cf5a6c84SAndroid Build Coastguard Workertesting '\1 p no newline' "sed 's/t\\(w\\)o/za\\1py/p'" \ 102*cf5a6c84SAndroid Build Coastguard Worker "one\nzawpy\nzawpy" "" "one\ntwo" 103*cf5a6c84SAndroid Build Coastguard Workertesting '-n s//\1/p' "sed -n 's/t\\(w\\)o/za\\1py/p'" "zawpy" "" "one\ntwo" 104*cf5a6c84SAndroid Build Coastguard Workertesting '-n s//\1/p no newline' "sed -n 's/t\\(w\\)o/za\\1py/p'" "zawpy" \ 105*cf5a6c84SAndroid Build Coastguard Worker "" "one\ntwo" 106*cf5a6c84SAndroid Build Coastguard Workertesting 'backref error' \ 107*cf5a6c84SAndroid Build Coastguard Worker "sed 's/w/ale \2 ha/' >/dev/null 2>/dev/null || echo no" \ 108*cf5a6c84SAndroid Build Coastguard Worker "no\n" "" "one\ntwo\nthree" 109*cf5a6c84SAndroid Build Coastguard Workertesting 'empty match after nonempty match' "sed -e 's/a*/c/g'" 'cbcncgc' \ 110*cf5a6c84SAndroid Build Coastguard Worker '' 'baaang' 111*cf5a6c84SAndroid Build Coastguard Workertesting 'empty match' "sed -e 's/[^ac]*/A/g'" 'AaAcA' '' 'abcde' 112*cf5a6c84SAndroid Build Coastguard Workertesting 's///#comment' "sed -e 's/TWO/four/i#comment'" "one\nfour\nthree" \ 113*cf5a6c84SAndroid Build Coastguard Worker "" "one\ntwo\nthree" 114*cf5a6c84SAndroid Build Coastguard Workertesting 's///num off end' 'sed -e s/e//2' 'e\n' '' 'e\n' 115*cf5a6c84SAndroid Build Coastguard Worker 116*cf5a6c84SAndroid Build Coastguard Workertesting 'N flushes pending a and advances match counter' \ 117*cf5a6c84SAndroid Build Coastguard Worker "sed -e 'a woo' -e 'N;\$p'" 'woo\none\ntwo\none\ntwo' "" 'one\ntwo' 118*cf5a6c84SAndroid Build Coastguard Workertesting "delimiter in regex [char range] doesn't count" "sed -e 's/[/]//'" \ 119*cf5a6c84SAndroid Build Coastguard Worker "onetwo\n" "" 'one/two\n' 120*cf5a6c84SAndroid Build Coastguard Workertesting "delete regex range start line after trigger" \ 121*cf5a6c84SAndroid Build Coastguard Worker "sed -e '/one/,/three/{' -e 'i meep' -e '1D;}'" \ 122*cf5a6c84SAndroid Build Coastguard Worker "meep\nmeep\ntwo\nmeep\nthree" "" "one\ntwo\nthree" 123*cf5a6c84SAndroid Build Coastguard Workertesting "blank pattern repeats last pattern" \ 124*cf5a6c84SAndroid Build Coastguard Worker "sed -e '/^three/s//abc&def/'" \ 125*cf5a6c84SAndroid Build Coastguard Worker "one two three\nabcthreedef four five\nfive six seven\n" "" \ 126*cf5a6c84SAndroid Build Coastguard Worker "one two three\nthree four five\nfive six seven\n" 127*cf5a6c84SAndroid Build Coastguard Worker 128*cf5a6c84SAndroid Build Coastguard Workertestcmd "interleave -e and -f" "-e 'a abc' -f input -e 'a ghi'" \ 129*cf5a6c84SAndroid Build Coastguard Worker "hello\nabc\ndef\nghi\n" "a def" "hello\n" 130*cf5a6c84SAndroid Build Coastguard Worker 131*cf5a6c84SAndroid Build Coastguard Worker# Different ways of parsing line continuations 132*cf5a6c84SAndroid Build Coastguard Worker 133*cf5a6c84SAndroid Build Coastguard Workertesting "" "sed -e '1a\' -e 'huh'" "meep\nhuh\n" "" "meep" 134*cf5a6c84SAndroid Build Coastguard Workertesting "" "sed -f input" "blah\nboom\n" '1a\\\nboom' 'blah' 135*cf5a6c84SAndroid Build Coastguard Workertesting "" "sed -f - input" "blah\nboom\n" 'blah' '1a\\\nboom' 136*cf5a6c84SAndroid Build Coastguard Workertesting "" "sed '1a\ 137*cf5a6c84SAndroid Build Coastguard Workerhello'" "merp\nhello\n" "" "merp" 138*cf5a6c84SAndroid Build Coastguard Worker 139*cf5a6c84SAndroid Build Coastguard Workertesting "" "sed -e '/x/c\' -e 'y'" 'y\n' '' 'x\n' 140*cf5a6c84SAndroid Build Coastguard Workertesting "" "sed -e 's/a[([]*b/X/'" 'X' '' 'a[(b' 141*cf5a6c84SAndroid Build Coastguard Workertoyonly testing "" "sed 'y/a\\bc/de\f/'" "db\f" "" "abc" 142*cf5a6c84SAndroid Build Coastguard Workertesting "[a-a] (for perl)" "sed '"'s/\([^a-zA-Z0-9.:_\-\/]\)/\\\1/g'"'" \ 143*cf5a6c84SAndroid Build Coastguard Worker 'he\ llo' "" "he llo" 144*cf5a6c84SAndroid Build Coastguard Worker 145*cf5a6c84SAndroid Build Coastguard Worker# Debian bug https://bugs.debian.org/635570 added code to ensure a file 146*cf5a6c84SAndroid Build Coastguard Worker# ends with a newline via "sed -e '$a\'". Apparently all a\ with no additional 147*cf5a6c84SAndroid Build Coastguard Worker# pattern lines after it does (other than making posix throw up) is 148*cf5a6c84SAndroid Build Coastguard Worker# flush the pending newline as _if_ it had added another line. *shrug* Ok? 149*cf5a6c84SAndroid Build Coastguard Workertesting "trailing a\ (for debian)" "sed 'a\\'" "hello\n" "" "hello" 150*cf5a6c84SAndroid Build Coastguard Worker 151*cf5a6c84SAndroid Build Coastguard Worker# You have to match the first line of a range in order to activate 152*cf5a6c84SAndroid Build Coastguard Worker# the range, numeric and ascii work the same way 153*cf5a6c84SAndroid Build Coastguard Workertoyonly testing "skip start of range" "sed -e n -e '1,2s/b/c/'" "a\nb\n" "" "a\nb\n" 154*cf5a6c84SAndroid Build Coastguard Workertesting "range +1" "sed -ne '/blah/,+1p'" "blah\n6\n" "" \ 155*cf5a6c84SAndroid Build Coastguard Worker "1\n2\n3\n4\n5\nblah\n6\n7\n8\n9\n" 156*cf5a6c84SAndroid Build Coastguard Workertesting "range +0" "sed -ne '/blah/,+0p'" "blah\n" "" \ 157*cf5a6c84SAndroid Build Coastguard Worker "1\n2\n3\n4\n5\nblah\n6\n7\n8\n9\n" 158*cf5a6c84SAndroid Build Coastguard Workertesting "range +3" "sed -ne '2,+3p'" "2\n3\n4\n5\n" "" \ 159*cf5a6c84SAndroid Build Coastguard Worker "1\n2\n3\n4\n5\nblah\n6\n7\n8\n9\n" 160*cf5a6c84SAndroid Build Coastguard Worker 161*cf5a6c84SAndroid Build Coastguard Workertesting "not -s" "sed -n 1p input -" "one" "one" "two" 162*cf5a6c84SAndroid Build Coastguard Workertesting "-s" "sed -sn 1p input -" "one\ntwo" "one\n" "two" 163*cf5a6c84SAndroid Build Coastguard Worker 164*cf5a6c84SAndroid Build Coastguard Workertesting "bonus backslashes" \ 165*cf5a6c84SAndroid Build Coastguard Worker "sed -e 'a \l \x\' -e \"\$(echo -e 'ab\\\nc')\"" \ 166*cf5a6c84SAndroid Build Coastguard Worker "hello\nl x\nab\nc\n" "" "hello\n" 167*cf5a6c84SAndroid Build Coastguard Worker 168*cf5a6c84SAndroid Build Coastguard Worker# toybox saying "no }" here broke the AOSP build. 169*cf5a6c84SAndroid Build Coastguard Workertesting "end b with }" "sed -n '/START/{:a;n;/END/q;p;ba}'" "b\nc\n" \ 170*cf5a6c84SAndroid Build Coastguard Worker "" "a\nSTART\nb\nc\nEND\nd" 171*cf5a6c84SAndroid Build Coastguard Worker 172*cf5a6c84SAndroid Build Coastguard Workertestcmd '-z' '-z "s/\n/-/g"' "a-b-c" "" "a\nb\nc" 173*cf5a6c84SAndroid Build Coastguard Workertestcmd '-z N' '-z N' 'one\0two\0' '' 'one\0two\0' 174*cf5a6c84SAndroid Build Coastguard Workertestcmd 'p noeol' '-z p' 'one\0one' '' 'one' 175*cf5a6c84SAndroid Build Coastguard Workertestcmd '-z N noeol' '-z N' 'one\0two' '' 'one\0two' 176*cf5a6c84SAndroid Build Coastguard Workertestcmd '-z S' "-z 'N;P'" 'one\0one\0two' '' 'one\0two' 177*cf5a6c84SAndroid Build Coastguard Workertestcmd '-z D' "-z 'N;D'" 'two' '' 'one\0two' 178*cf5a6c84SAndroid Build Coastguard Workertestcmd '-z G' "-z 'h;G'" 'one\0one' '' 'one' 179*cf5a6c84SAndroid Build Coastguard Workertestcmd '-z H' "-z 'H;g'" '\0one' '' 'one' 180*cf5a6c84SAndroid Build Coastguard Workertoyonly testcmd '-z x NOEOL' '-z ax' 'abc\0x\0def\0x\0' '' 'abc\0def' 181*cf5a6c84SAndroid Build Coastguard Workertestcmd 's after NUL' 's/t/x/' 'one\0xwo' '' 'one\0two' 182*cf5a6c84SAndroid Build Coastguard Workertestcmd '^ not trigger after NUL' 's/^t/x/' 'one\0two' '' 'one\0two' 183*cf5a6c84SAndroid Build Coastguard Worker 184*cf5a6c84SAndroid Build Coastguard Worker# toybox handling of empty capturing groups broke minjail. Check that we 185*cf5a6c84SAndroid Build Coastguard Worker# correctly replace an empty capturing group with the empty string: 186*cf5a6c84SAndroid Build Coastguard Workertestcmd '\n with empty capture' \ 187*cf5a6c84SAndroid Build Coastguard Worker '-E "s/(ARM_)?(NR_)([a-z]*) (.*)/\1\2\3/"' "NR_read" "" "NR_read foo" 188*cf5a6c84SAndroid Build Coastguard Worker# ...but also that we report an error for a backreference to a group that 189*cf5a6c84SAndroid Build Coastguard Worker# isn't in the pattern: 190*cf5a6c84SAndroid Build Coastguard Workertestcmd '\n too high' '-E "s/(.*)/\2/p" 2>/dev/null || echo OK' "OK\n" "" "foo" 191*cf5a6c84SAndroid Build Coastguard Worker 192*cf5a6c84SAndroid Build Coastguard Workertoyonly testcmd 's///x' '"s/(hello )?(world)/\2/x"' "world" "" "hello world" 193*cf5a6c84SAndroid Build Coastguard Worker 194*cf5a6c84SAndroid Build Coastguard Worker# Performance test 195*cf5a6c84SAndroid Build Coastguard WorkerX=x; Y=20; while [ $Y -gt 0 ]; do X=$X$X; Y=$(($Y-1)); done 196*cf5a6c84SAndroid Build Coastguard Workertesting 'megabyte s/x/y/g (20 sec timeout)' \ 197*cf5a6c84SAndroid Build Coastguard Worker "timeout 20 sed 's/x/y/g' | sha1sum" \ 198*cf5a6c84SAndroid Build Coastguard Worker '138c1fa7c3f64186203b0192fb4abdb33cb4e98a -\n' '' "$X\n" 199*cf5a6c84SAndroid Build Coastguard Workerunset X Y 200*cf5a6c84SAndroid Build Coastguard Worker 201*cf5a6c84SAndroid Build Coastguard Workertestcmd "w doesn't blank" "-e 'w one' -e 'w one' -e d; cat one" \ 202*cf5a6c84SAndroid Build Coastguard Worker 'hello\nhello\n' '' 'hello\n' 203*cf5a6c84SAndroid Build Coastguard Worker 204*cf5a6c84SAndroid Build Coastguard Workertestcmd 's i and I' 's/o/0/ig' "f00l F00L" "" "fool FOOL" 205*cf5a6c84SAndroid Build Coastguard Worker 206*cf5a6c84SAndroid Build Coastguard Workertestcmd 's l ignores posix' "-n 'N;l'" 'one\\ntwo$\n' '' 'one\ntwo\n' 207*cf5a6c84SAndroid Build Coastguard Workertestcmd 's l loses missing newline' "-n 'N;l'" 'one\\ntwo$\n' '' 'one\ntwo' 208*cf5a6c84SAndroid Build Coastguard Workertestcmd 's -z l' "-zn 'N;l'" 'one\\000two$\0' '' 'one\0two\0' 209*cf5a6c84SAndroid Build Coastguard Workertestcmd 's -z l missing newline' "-zn 'N;l'" 'one\\000two$\0' '' 'one\0two' 210*cf5a6c84SAndroid Build Coastguard Worker 211*cf5a6c84SAndroid Build Coastguard Workertestcmd 'count match' '"s/./&X/4"' '0123X45\n' '' '012345\n' 212*cf5a6c84SAndroid Build Coastguard Worker 213*cf5a6c84SAndroid Build Coastguard Worker# -i with $ last line test 214*cf5a6c84SAndroid Build Coastguard Worker 215*cf5a6c84SAndroid Build Coastguard Worker#echo meep | sed/sed -e '1a\' -e 'huh' 216*cf5a6c84SAndroid Build Coastguard Worker#echo blah | sed/sed -f <(echo -e "1a\\\\\nboom") 217*cf5a6c84SAndroid Build Coastguard Worker#echo merp | sed/sed "1a\\ 218*cf5a6c84SAndroid Build Coastguard Worker#hello" 219