Skip to content

doc: expand the lake test and lint driver section#855

Open
kim-em wants to merge 3 commits into
mainfrom
test-driver-doc
Open

doc: expand the lake test and lint driver section#855
kim-em wants to merge 3 commits into
mainfrom
test-driver-doc

Conversation

@kim-em
Copy link
Copy Markdown
Collaborator

@kim-em kim-em commented May 27, 2026

This PR expands the "Test and Lint Drivers" chapter in the Lake reference to make lake test and lake lint substantially easier to follow on a first read. The previous text was a single short paragraph that mentioned @[test_driver] once without an example. The new section covers:

  • what a test or lint driver actually is — a target (executable, script, or library) that Lake invokes; Lake itself is not a test framework,
  • exit-code semantics for executable and script drivers, and the elaboration-error contract for library drivers,
  • a verified lakefile.toml example for both testDriver and lintDriver,
  • prose instructions for the equivalent lakefile.lean configuration (without a code example, since the surrounding chapter is currently in a :::TODO because importing Lake's attributes crashes the compiler),
  • the single-driver constraint and the conflict between the attribute and the configuration field,
  • the <pkg>/<name> syntax for drivers defined in dependency packages,
  • how testDriverArgs and lintDriverArgs compose with arguments passed after -- on the command line,
  • the restriction that library test drivers do not accept arguments,
  • notes on lake check-test and lake check-lint.

Motivated by a recent Zulip thread asking for better documentation:
https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/Using.20.60lake.20test.60.20effectively/near/598083186

🤖 Prepared with Claude Code

kim-em and others added 2 commits May 28, 2026 00:20
This PR expands the "Test and Lint Drivers" chapter in the Lake reference
to cover what a test or lint driver actually is (a target — executable,
script, or library — not a test framework), with verified `lakefile.toml`
examples and prose instructions for `lakefile.lean`. New material:

* exit-code semantics for executable/script drivers and the elaboration-error
  contract for library drivers,
* configuring with `testDriver`/`lintDriver` versus `@[test_driver]`/
  `@[lint_driver]` attributes, including the single-driver constraint,
* the `<pkg>/<name>` syntax for drivers in dependency packages,
* `lake test` and `lake lint` argument handling, including how
  `testDriverArgs`/`lintDriverArgs` compose with arguments after `--`,
* the library-driver argument restriction,
* notes on `lake check-test` and `lake check-lint`.

🤖 Prepared with Claude Code
Vale flagged em dashes with surrounding spaces and the bare word
'lakefile'. Rewrite the prose without em dashes and replace 'in the
same lakefile'/'in the lakefile' with 'in the same configuration'/
elided forms that Vale accepts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Address review feedback on the previous draft:

* Add a paragraph explaining that `lake lint` also runs Lake's builtin
  linter when enabled, and that positional `MODULE` arguments go to the
  builtin linter, not to the configured driver. `lake lint Mathlib` and
  `lake lint -- Mathlib` are different things.
* Note that `check-lint` exits 0 also when `builtinLint := true` is set.
* Fix the opening sentence of "Test and Lint Drivers" to acknowledge that
  library test drivers are exercised by elaboration, not run.
* Reword "drivers in dependencies aren't run" as "Lake doesn't automatically
  run each dependency package's driver" so that the `<pkg>/<name>` form,
  covered later, doesn't read as a contradiction.
* Soften "the attribute form is the more common style" to "often
  convenient".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Preview for this PR is ready! 🎉 (also as a proofreading version). built with commit f1b44ff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HTML available HTML has been generated for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants