Print the byte unit once in the summary line (closes #17) #20

Merged
clawbot merged 1 commits from summary-byte-unit into next 2026-10-06 08:27:08 +02:00
Collaborator

The summary line after sum, check and clear put the word bytes after the output of formatBytes, which already ends in a unit, so it read 9 B bytes or 1.0 KiB bytes (#17). The format string in Stats.Print no longer adds the word, so the line now ends like 0 failed, 14 B in 1ms.

So that a test can read the line, Stats.Print now takes the io.Writer to print to as its first argument. All three callers pass os.Stderr, so where the line goes is unchanged. The new test prints the summary for 9 bytes and for 1536 bytes into a buffer and looks for 9 B in and 1.5 KiB in.

README.md shows no sample summary line, so it is unchanged.

Model: opus-5-5

The summary line after `sum`, `check` and `clear` put the word `bytes` after the output of `formatBytes`, which already ends in a unit, so it read `9 B bytes` or `1.0 KiB bytes` (https://git.eeqj.de/sneak/attrsum/issues/17). The format string in `Stats.Print` no longer adds the word, so the line now ends like `0 failed, 14 B in 1ms`. So that a test can read the line, `Stats.Print` now takes the `io.Writer` to print to as its first argument. All three callers pass `os.Stderr`, so where the line goes is unchanged. The new test prints the summary for 9 bytes and for 1536 bytes into a buffer and looks for `9 B in` and `1.5 KiB in`. `README.md` shows no sample summary line, so it is unchanged. Model: opus-5-5
clawbot added the needs-review label 2026-10-06 07:40:23 +02:00
clawbot self-assigned this 2026-10-06 07:40:23 +02:00
clawbot added needs-rebase and removed needs-review labels 2026-10-06 07:44:47 +02:00
clawbot added 1 commit 2026-10-06 08:03:46 +02:00
formatBytes already ends in a unit, so the summary line read "9 B
bytes" or "1.0 KiB bytes". The format string in Stats.Print no longer
adds the word "bytes".

Print now takes the io.Writer to print to; its callers pass os.Stderr,
and the new test passes a buffer to read the line for one small and
one large byte count.

Model: opus-5-5
clawbot force-pushed summary-byte-unit from c49c5e63b9 to 3f9f150736 2026-10-06 08:03:46 +02:00 Compare
clawbot added needs-review and removed needs-rebase labels 2026-10-06 08:03:49 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 9e55fd7113 into next 2026-10-06 08:27:08 +02:00
clawbot deleted branch summary-byte-unit 2026-10-06 08:27:09 +02:00
Sign in to join this conversation.