<feed xmlns='http://www.w3.org/2005/Atom'>
<title>dotemacs/tests/test-meta-subr-mock-arity.el, branch main</title>
<subtitle>My Emacs configuration
</subtitle>
<id>https://git.cjennings.net/dotemacs/atom?h=main</id>
<link rel='self' href='https://git.cjennings.net/dotemacs/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/dotemacs/'/>
<updated>2026-06-21T07:19:08+00:00</updated>
<entry>
<title>test: make subr mocks variadic for native-comp, add arity meta-test</title>
<updated>2026-06-21T07:19:08+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-06-21T07:19:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/dotemacs/commit/?id=a249e415c7199e3d4698f1956687fa351296a357'/>
<id>urn:sha1:a249e415c7199e3d4698f1956687fa351296a357</id>
<content type='text'>
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 &amp;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.
</content>
</entry>
</feed>
