t0021: expect more variations in the output of uniq -c

Some versions of uniq -c write the count left-justified, other version write it right-justified. Be prepared for both kinds. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jeff King <peff@peff.net>

Johannes Sixt committed Nov 3, 2016 at 21:12 UTC 038212c4c40c4cd9eb518fb1fbb5eb0d0d7d8f67
1 file changed +3 -4
t/t0021-conversion.sh
+3 -4
@@ -40,10 +40,9 @@ test_cmp_count () {
40 actual=$2
41 for FILE in "$expect" "$actual"
42 do
43 - sort "$FILE" | uniq -c | sed "s/^[ ]*//" |
44 - sed "s/^\([0-9]\) IN: clean/x IN: clean/" |
45 - sed "s/^\([0-9]\) IN: smudge/x IN: smudge/" >"$FILE.tmp" &&
46 - mv "$FILE.tmp" "$FILE"
43 + sort "$FILE" | uniq -c |
44 + sed -e "s/^ *[0-9][0-9]*[ ]*IN: /x IN: /" >"$FILE.tmp" &&
45 + mv "$FILE.tmp" "$FILE" || return
46 done &&
47 test_cmp "$expect" "$actual"
48 }