1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-17 02:31:02 +00:00
uutils-coreutils/tests
Jeffrey Finkelstein 97a49c7c95 wc: compute min width to format counts up front
Fix two issues with the string formatting width for counts displayed
by `wc`.

First, the output was previously not using the default minimum width
(seven characters) when reading from `stdin`. This commit corrects
this behavior to match GNU `wc`. For example,

    $ cat alice_in_wonderland.txt | wc
          5      57     302

Second, if at least 10^7 bytes were read from `stdin` *after* reading
from a smaller regular file, then every output row would have width
8. This disagrees with GNU `wc`, in which only the `stdin` row and the
total row would have width 8. This commit corrects this behavior to
match GNU `wc`. For example,

    $ printf "%.0s0" {1..10000000} | wc emptyfile.txt -
	  0       0       0 emptyfile.txt
	  0       1 10000000
	  0       1 10000000 total

Fixes #2186.
2021-05-15 21:41:47 -04:00
..
by-util wc: compute min width to format counts up front 2021-05-15 21:41:47 -04:00
common Migrate mknod to clap, closes #2051 (#2056) 2021-05-05 22:59:40 +02:00
fixtures sort: make merging stable 2021-05-09 11:43:38 +02:00
tests.rs tests ~ use build.rs build list of test_UTIL module files 2020-06-02 12:17:30 -05:00