test: compile stdx as its own test root — its tests had never run - #65
Merged
Conversation
stdx is a separate module, and module dependencies contribute no tests to a test root, so every test in stdx (PRNG, log, helpers) was invisible to zig build test. Adding the root immediately caught two casualties of that blind spot: TestLogger no longer compiled on Zig 0.16 (ArrayList init and writer API drift), and no_padding became vacuous (@bitSizeOf now includes struct padding, so the check is always true) — fixed and deleted respectively. 41 stdx tests now run under test/test-unit.
The new stdx test root failed to compile on Linux:
std/c.zig: error: dependency on libc must be explicitly specified
stdx wraps libc directly — std.c sockets, fcntl, file IO — so it needs the
link wherever it is rooted. Every consumer sets link_libc on its own root
module, which covers stdx as a dependency but not a test artifact rooted at
stdx itself. macOS links libc implicitly, so this only showed up on Linux.
Verified test-unit passes on both macOS and Linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a second test compilation rooted at
src/stdx/mod.zigtozig build test/test-unit, references the PRNG's tests so they're collected, fixesTestLogger(didn't compile on Zig 0.16 — ArrayList init + writer API drift), and deletesno_padding(@bitSizeOfnow includes struct padding, making the check vacuously true; zero call sites).Why
stdx is its own module, and module dependencies contribute no tests to a test root — so no stdx test has ever run in any build step. Surfaced by review on #58, which needs the deterministic PRNG's tests actually executing. Lazy analysis hiding broken code is this repo's known failure mode; this closes it for stdx's referenced files.
Watch
mod.zigtest blocks are collected — a sweep to reference the rest (fs, net, time, io, e2e framework) is follow-up work.