Skip to content

feat: run Errata tests interactively in a widget - #959

Open
david-christiansen wants to merge 21 commits into
mainfrom
test-framework-3
Open

david-christiansen wants to merge 21 commits into
mainfrom
test-framework-3

Conversation

@david-christiansen

Copy link
Copy Markdown
Collaborator

Tests can additionally be run interactively using a widget. When the text cursor is on a test's source span, the InfoView offers a "run" button that runs the test in a separate process, streaming its output as it is produced and killing the process if the run is cancelled.

@david-christiansen
david-christiansen force-pushed the test-framework-3 branch 2 times, most recently from 2defc44 to ab8f221 Compare August 26, 2026 15:10
@Vtec234
Vtec234 self-requested a review August 27, 2026 14:06
Base automatically changed from test-framework-2 to main September 10, 2026 13:45
@david-christiansen
david-christiansen force-pushed the test-framework-3 branch 2 times, most recently from 28946cb to 2647d9e Compare September 10, 2026 16:08
let lineStart := fileMap.ofPosition ⟨(fileMap.toPosition attrPos).line, 0⟩
let inputCtx := Parser.mkInputContext fileMap.source (← getFileName)
let pmctx : Parser.ParserModuleContext := { env := ← getEnv, options := ← getOptions }
let (cmdStx, _, _) := Parser.parseCommand inputCtx pmctx { pos := lineStart } {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-parsing is a bit of waste - AttrM really should have easier access to the syntax of the marked declaration; but that's a core change AFAICT. There's an attribute with the same issue in verso-blueprint.

Comment thread src/errata-tests/ErrataTests.lean
Tests can additionally be run interactively using a widget. When the text
cursor is on a test's source span, the InfoView offers a "run" button that
runs the test in a separate process, streaming its output as it is produced
and killing the process if the run is cancelled.
The run's lifecycle is one reducer over idle/running/done/cancelled/
failed states, each carrying only its own data, so a verdict cannot
coexist with an error or a spinner. Timings come from the server's
per-run record, so revisiting a test mid-run keeps its true elapsed
time instead of restarting the clock.
The runner evaluates the action that `@[test]` compiled beside a test instead
of synthesizing its instance again, and takes its context from `mkContext`,
which draws the seed the context now requires.

@Vtec234 Vtec234 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One confusing behavior I found: nested stdout/err boxes do not have a copy button, whereas the copy button on the top box actually copies all the output including nested outputs. Since the boxes are visually separated, this feels surprising.

83C535FF-7F4E-44F9-B75E-821B1E937E9A.mov

@Vtec234

Vtec234 commented Sep 15, 2026

Copy link
Copy Markdown
Member

I am also wondering, should assertTrue condition message display message in the widget on failure? It currently doesn't.

This branch has not been deployed

No deployments
Sign up for free to 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.

2 participants