Add a testscript end-to-end layer for the CLI contract - #61
Open
MPV wants to merge 1 commit into
Open
Conversation
The existing approvals/ suite tests manifest -> images at the processor level; nothing exercises the actual binary's user contract (argv + stdin -> stdout, stderr, exit code). Add a black-box e2e layer using rogpeppe/go-internal's testscript (already in the module graph via go-approval-tests, so no new download): main_test.go registers the real kir program as a testscript command, and each testdata/script/*.txtar is one self-contained scenario with its fixtures inlined. Seven scenarios: single file, multi-document file, multiple file args, stdin, an unsupported kind, a missing path, and no-args usage. approvals/ and the unit tests are left untouched; this is an additive, standalone layer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
MPV
force-pushed
the
claude/e2e-testscript
branch
from
August 2, 2026 07:20
4e29688 to
c229fb3
Compare
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
A black-box e2e layer that runs the real
kirbinary and asserts the actual user contract —argv+stdin→stdout,stderr, exit code — usingtestscript. Each scenario is one self-contained.txtarfile with its fixtures inlined.main_test.go— registers the real program as a testscript command (TestMain+TestScripts).testdata/script/*.txtar— 7 scenarios.This is what "combining e2e + golden" looks like in practice: the script is the golden, and it natively models the exit code and stderr, which
approvals.VerifyStringcan't.Why here (vs. approvals in
cmd/)approvals/testsmanifest → imagesat the processor level; nothing covers the binary's CLI contract (exit codes, real stderr, arg/stdin wiring). This adds that top layer without touchingapprovals/or the unit tests — an additive, standalone layer to get a feel for the ergonomics.The 7 scenarios
basiccmp stdout)multidoc-file----separated docs in one file, in document ordermultiple-filesstdinkir -reading a real stdin pipeunsupported-kindmissing-fileusageUsage:on stderr, non-zero exit (! kir)Cost
rogpeppe/go-internalpromoted to a directrequire— already in the graph viago-approval-tests, so no new download.-race,vet,gofmt, andgo mod tidyare all clean.To regenerate expectations after an intended behavior change, wire testscript's
UpdateScriptsbehind a-updateflag (not wired here; expectations are hand-written and verified against the real binary).🤖 Generated with Claude Code
https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC