Skip to content

Commit 038212c

Browse files
j6tpeff
authored andcommitted
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 <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 0f71fa2 commit 038212c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

t/t0021-conversion.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ test_cmp_count () {
4040
actual=$2
4141
for FILE in "$expect" "$actual"
4242
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
4746
done &&
4847
test_cmp "$expect" "$actual"
4948
}

0 commit comments

Comments
 (0)