Per review, assert the exact stdout for both --expand-tabs and the
default tab path instead of a column helper, so the test also pins the
exact tabs/spaces emitted.
Shorten the two long comments per review, and add an integration test in
tests/integration.rs exercising `-y --width=40` in both the default
(expand_tabs: false, tab-padding path) and --expand-tabs modes, asserting
the gutter marker lands at the middle of the gutter.
In side-by-side output the gutter marker was written wherever
process_half_line stopped padding the left half (one column past
sdiff_half_width), not at separator_pos (the middle of the gutter).
Those agree only when the gutter is 3 or 4 columns wide, so the default
--width=130 --tabsize=8 (gutter 3) looked right while other widths/tab
sizes drifted (e.g. --width=40 placed '<' at column 17 instead of 19).
Pad from half_width + 1 up to separator_pos before writing the marker so
it lands at the gutter middle, matching GNU sdiff. format_tabs_and_spaces
is a no-op when already at/past separator_pos, so narrow gutters are
unaffected. Add a regression test at --width=40.
Fixes#269
The savannah gitweb interface is regularly rate-limited or unavailable, so
retry it and then fall back to the official gnulib mirror on GitHub rather
than failing the whole GNU testsuite job.
The --verbose branch of format_verbose_difference padded the byte-offset
column with a plain subtraction while the --print-bytes branch above it
already used saturating_sub. offset_width is derived from the smaller
file's metadata length, so a file reporting length 0 that still yields
bytes (/dev/zero) collapses it to 2 and the subtraction underflows once
the offset reaches three digits.
Fixes#265
This is not needed now that tests automatically look for `gpatch` on mac
since commit 1254f146f8 ("tests: validate "patch" and "ed" commands
once, print meaningful messages (#226)")
The fewer PATH changes, the better.
Signed-off-by: Marc Herbert <Marc.Herbert@gmail.com>
When we fail to find `gpatch`, don't say that we failed to find `patch`.
Cosmetic fix to commit 1254f146f8 ("tests: validate "patch" and "ed"
commands once, print meaningful messages (#226)")
This is an extremely minor fix because the error message already printed
"gpatch validation failed, no such file or directory" even before this
commit.
Signed-off-by: Marc Herbert <Marc.Herbert@gmail.com>
macOS' /usr/bin/patch and GNU patch have very subtle incompatibilities
that cause only some "more advanced" tests to fail in obscure and very
time-consuming ways - while other tests pass. In some cases (depending
on test threads racing), the lack of newlines in some test data even
causes the whole test suite to stall.
This fix runs `patch -version` (only once), makes sure the output starts
with "GNU patch" and shows a meaningful assert message when not. It also
looks for `gpatch` instead of `patch` on macOS and shows a meaningful
assert message if either is missing.
Fixes: #225
This also provides faster and better feedback when `ed` is missing (see
#39) and implements a portable and basic check.
Last but not least, this new code is generic enough to support the
validation of any other test dependency in the future.
* feat: u64 for --bytes and --ignore-initial
fix: bumped up tempfile to "3.26.0"
The variables for --bytes, --ignore-initial and line count where size 'usize',
thus limiting the readable bytes on 32-bit systems.
GNU cmp is compiled with LFS (Large File Support) and allows i64 values.
This is now all u64, which works also on 32-bit systems with Rust.
There is no reason to implement a 32-bit barrier for 32 bit machines.
Additionally the --bytes limit can be set to 'u128' using the feature
"cmp_bytes_limit_128_bit".
The performance impact would be negligible, as there only few calculations
each time a full block is read from the file.
---------
Co-authored-by: Gunter Schmidt <gsgit@beadsoft.de>
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>