Skip to content

Run the standard library's own tests - #1243

Merged
Frotty merged 1 commit into
masterfrom
test/run-stdlib-tests
Aug 17, 2026
Merged

Run the standard library's own tests#1243
Frotty merged 1 commit into
masterfrom
test/run-stdlib-tests

Conversation

@Frotty

Copy link
Copy Markdown
Member

A bump of the pinned standard library was only ever checked for still compiling. That is a weak signal for a change whose point is behaviour, and a bad one for the parts of the library which degrade quietly rather than failing: the multibyte detection in String.wurst concludes the engine has no multibyte characters when it cannot find what it probes for, so a version where it silently gave up would look exactly like one where it worked.

All 460 of the library's test functions run now, on the interpreter.

Why they were invisible

A library compiles in only what is imported, so a program importing nothing pulls in no test functions at all — and executeTests fails only when passed < total, which 0 < 0 is not.

The first version of this test therefore passed while running nothing. It looked exactly like the version that works. I caught it by printing the count rather than trusting the colour, and that near miss shaped the rest of the change.

What it does

  • StdLibOwnTests collects every package in the checkout whose name ends in Tests, reading the package name out of the file rather than assuming it matches the path, and imports them all. A test file added by a later bump is picked up by being there rather than by someone remembering to list it.
  • executeTests returns how many tests ran, and expectAtLeastTests(n) fails when fewer than n did. The floor is deliberately far below the real count — it exists to catch a program holding none, not to be updated on every bump.

The guard is checked rather than assumed: raising the floor to 100000 produces expected at least 100000 Wurst tests to run, but 460 did, which is also where the 460 comes from.

Scope

The interpreter half only. executeTests runs the tests through RunTests on the intermediate language, so running them on Lua needs the harness to execute a Wurst test function on that target rather than an init block — new machinery rather than a flag, and left as backlog item 22. It is worth doing: every disagreement between the targets found so far was found by running the same program on both.

Full suite green, 8m41s.

A bump of the pinned version was only checked for still compiling, which says
little about a change whose point is behaviour and less about the parts of the
library which degrade quietly: the multibyte detection in String.wurst decides
the engine has no multibyte characters when it cannot find what it probes for,
so a version where it silently gave up looked exactly like one where it worked.
All 460 of its test functions run now. They were invisible because a library
compiles in only what is imported, so a program importing nothing runs none of
them - and the first version of this test passed while doing exactly that.
The imports are collected from the checkout rather than written down, so a
later bump brings its new test files with it.
That near miss is why executeTests reports how many ran and expectAtLeastTests
fails when too few do: every test passing and there being no tests were the
same green, in a harness whose whole job is to tell those apart.
@Frotty
Frotty merged commit cc0b55c into masterAug 17, 2026
6 checks passed
@Frotty
Frotty deleted the test/run-stdlib-tests branch August 17, 2026 07:19
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Frotty