To run the complete test suite:
- Full test suite (recommended):
just testorcargo nextest run --workspace && cargo test --doc - Powertests:
cargo test --test cli_tests --features powertest - Snapshots / trycmd:
just itest - Code Coverage:
just coverage— Generate and print code coverage report viacargo-llvm-cov.just coverage-html— Generate browsable HTML report intarget/llvm-cov/html/index.html.just coverage-lcov— Generatelcov.infofor CI/Codecov integration.just coverage-gate 70— Enforce quality gate (fails if line coverage is below specified threshold).
In order to test your changes on lez, you will need to do one or multiple things in different cases.
You will need the additional tool
You will also need to modify the devtools/dir-generator.sh file if you want to add some test cases
Add it to powertest.yaml, then run just regen to regenerate powertesting.
Look into tests/gen or tests/cmd for any tests not passing.
Two things about powertest.yaml are worth knowing before you edit it, both
guarded by tests/cli_options/powertest_config.rs:
- The generator renders a key and its value as
<flag> <value>, with a space, and there is no way to ask it for an equals sign. Flags declared withrequire_equalsdo not accept that form, so their values are written into the key itself —--color=alwayswith novalues:list — one entry per value. The test reads the set of such flags off the clap command, so a new one fails the suite until it is spelled out here too. binary:andgen_binary:end up in every generated case asbin.name, so they must name the binary this project actually builds.
Regeneration is idempotent: with the working tree clean, just regen rewrites
tests/ptests byte for byte. If it does not, the generator and the committed
cases have drifted and one of them is wrong.
Case file names are ptest_<hash>.toml, where the hash comes from Rust's
DefaultHasher over the argument string. That hasher carries no stability
guarantee across Rust releases, so a future toolchain could rename every case
at once. If a regeneration ever produces a full set of new names with unchanged
contents, this is why — the .stdout and .stderr files have to be renamed
alongside them.
macOS gives every file that a third-party app, or anything it starts, creates
or writes a com.apple.provenance attribute, and SIP keeps it from being
removed. Run from iTerm, VS Code or Claude, the suite therefore finds it on
every fixture it makes, and the long view marks each one with @, as ls -l@
does. Run from Apple's Terminal, or on CI, it does not.
- A test that is not about extended attributes passes
--no-extended, so the marker stays out of its expected output wherever it runs. - A test that is about them starts with
fresh_files_have_no_attributes()fromtests/common, which skips it where every new file already has one of the system's, and fails it on CI, where a skip would hide that it proves nothing.
Please run nix build -L trydump or just idump
And lookout for any test no longer passing