| |
|
|
|
|
|
|
| |
Re-enabling native-comp surfaced a suite-wide fragility. When a test redefines a C primitive (or a native-compiled function), native-comp routes native callers through a trampoline that calls the mock with the primitive's maximum arity. A fixed-arity mock narrower than the primitive then throws wrong-number-of-arguments, intermittently, as the eln-cache fills.
I swept every arity-narrow subr mock to append &rest _ (188 sites, preserving any named args the body uses), and added tests/test-meta-subr-mock-arity.el, which fails make test on any subr mock too narrow for the primitive's arity. The rule isn't "never mock a subr". The suite mocks message and completing-read freely. It's "a subr mock must accept the primitive's arity."
Background, the three failure modes, and the research are in docs/native-comp-subr-mocking.org.
|
|
|
predicates
Four new test files extending the existing test-host-environment.el
(which already covered the two battery helpers).
- platform-predicates: env-linux-p, env-bsd-p, env-macos-p, env-windows-p
walked across every supported system-type value. 8 tests.
- display-predicates: env-x-p, env-x11-p, env-wayland-p, env-terminal-p,
env-gui-p exercised under every relevant combination of window-system,
WAYLAND_DISPLAY, and display-graphic-p. 13 tests.
- env-laptop-p: composition over the helpers, with Linux dispatch
isolated from non-Linux dispatch via system-type binding. 8 tests
including env-desktop-p as the inverse. battery-status-function is
forward-declared in this test file (initialized to nil) so cl-letf's
symbol-value place can read the prior value without hitting
void-variable.
- detect-system-timezone: the four-method priority chain. Mocks
cj/match-localtime-to-zoneinfo and getenv at the boundary; uses
cl-letf on file-exists-p / insert-file-contents to exercise the
/etc/timezone fall-through without touching real system files.
5 tests.
34 new tests for host-environment, all passing. Full suite green.
|