From 08a309ea45fb2f4a86401a96516c207b120a1f07 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 28 Oct 2026 14:29:00 -0500 Subject: [PATCH] And the tests. --- tests/ls.test | 10 +++++----- tests/sed.test | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/tests/ls.test b/tests/ls.test index ed6cde66..7833f2c1 100755 --- a/tests/ls.test +++ b/tests/ls.test @@ -72,11 +72,11 @@ testcmd "-w test 3" "-Cw 3" "a\nb\nc\nd\ne\nf\n" "" "" testcmd "-w test 4" "-Cw 4" "a d\nb e\nc f\n" "" "" rm -f a b c d e f -touch 'hello world' -testcmd "default escaping" "" "hello world\n" "" "" -testcmd "" "-b" 'hello\\ \\rworld\n' "" "" -testcmd "" "-q" 'hello ?world\n' "" "" -testcmd "" "-N" 'hello world\n' "" "" +touch $'hello \rworld\x01\x7f' +testcmd "default escaping" "" 'hello \rworld\x01\x7f\n' "" "" +testcmd "" "-b" 'hello\\ \\rworld\\001\\177\n' "" "" +testcmd "" "-q" 'hello ?world??\n' "" "" +testcmd "" "-N" 'hello \rworld\x01\x7f\n' "" "" # testcmd "" "-qN" 'hello ?world\n' "" "" behaves differently, and ok with it. rm hello* diff --git a/tests/sed.test b/tests/sed.test index 1790c7d2..19926297 100755 --- a/tests/sed.test +++ b/tests/sed.test @@ -200,6 +200,26 @@ testcmd 's -z l missing newline' "-zn 'N;l'" 'one\\000two$\0' '' 'one\0two' testcmd 'count match' '"s/./&X/4"' '0123X45\n' '' '012345\n' +testing 'l wrap' 'seq 98 160 | xargs | sed -n l' \ +'98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115\ + 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 \ +133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 1\ +50 151 152 153 154 155 156 157 158 159 160$\n' '' '' +RAW= testing 'l escapes' \ + 'for i in $(seq 1 255); do echo -ne "\\x$(printf %02x $i)"; done | sed -n l' \ +'\001\002\003\004\005\006\a\b\t$ +\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\ +\035\036\037 !"#$%&'\''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX\ +YZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\ +\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\ +\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\ +\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\ +\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\ +\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\ +\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\ +\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\ +\375\376\377$'$'\n' '' '' + # -i with $ last line test #echo meep | sed/sed -e '1a\' -e 'huh' -- 2.39.5