mirror of
https://github.com/xroche/httrack.git
synced 2026-07-23 17:19:17 +03:00
The hidden engine self-tests had accreted into a grab-bag of arbitrary
single-letter/-digit -# arms (-#0, -#A, -#W, ...) buried in the htscoremain.c
option switch, with no mnemonics and stale --help text. Collapse them into one
registry: -#test lists every test with a usage hint and one-line description,
and -#test=NAME [args] runs one.
The handlers and the two helpers they used (basic_selftests,
string_safety_selftests) move to a new htsselftest.c keyed by a
{name, args, desc, fn} table; htscoremain.c keeps only a small dispatch that
runs ahead of the no-URL usage gate, so a bare -#test (or an arg-less test like
copyopt/dns/cookies) no longer needs a dummy URL token to be reached. The
genuine debug knobs (-#L, -#C, -#R, -#h, ...) stay as letters in the switch;
only the unit self-tests, whose sole callers are tests/01_engine-*.test, are
renamed, so this is internal-only with no compatibility surface. Behavior is
preserved: each test prints the same result line and exit code, which the
existing assertions pin. Three now-unused includes (htscache_selftest.h,
htsdns_selftest.h, htsencoding.h) drop out of htscoremain.c.
Tests: the engine tests move to -#test=NAME; 01_engine-hashtable now asserts its
success line (not just exit code) so a misrouted registry row can't pass, and a
new 01_engine-selftest-dispatch covers the bare-list and unknown-name paths.
The --help/man "guru options" list now points at -#test instead of enumerating
a stale subset. The lone vestigial alias --debug-testfilters still resolves to
the removed -#0 (it was already non-functional: param1 supplies one argument,
-#0 required two); it is left untouched because editing that array forces
clang-format to reflow the whole untouched table.
Signed-off-by: Xavier Roche <roche@httrack.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
632 B
Bash
Executable File
19 lines
632 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Regression guard for the unsigned-enum sentinel trap: copy_htsopt's
|
|
# `if (from->X > -1)` guard is always false for unsigned hts_boolean fields, so
|
|
# they silently stop being copied. Driven by the in-process 'httrack -#test=copyopt' test.
|
|
# Keep POSIX-portable (harness runs it via $(BASH), a plain /bin/sh on macOS).
|
|
|
|
set -eu
|
|
|
|
# 'run' is an ignored placeholder argument.
|
|
out=$(httrack -#test=copyopt run)
|
|
|
|
# Exact-match the success line so a renamed/removed test (it prints the registry
|
|
# to stderr) can't pass.
|
|
test "$out" = "copy-htsopt: OK" || {
|
|
echo "expected 'copy-htsopt: OK', got: $out" >&2
|
|
exit 1
|
|
}
|