[test] end-to-end golden suite: build binary, run samples, assert stdout/exit (STAR-53)#20
Merged
Merged
Conversation
…out/exit (STAR-53)
The v0.1.0 cost-price audit's flagship P0 gap: no test built the real binary and
ran scripts through it, so the wired modules were only "load-verified", never
proven to work. Add an e2e package whose TestMain builds the starcli binary and
runs sample scripts via exec.Command, asserting stdout and the exit code.
Cases (through the real CLI):
- print / basic output
- the newly-wired pure domain modules actually produce results: emoji
(emojize -> a glyph), yaml (decode), qrcode (encode().size)
- fail() aborts non-zero with the message on stderr
- cmd is disabled by default (run() -> non-zero + "disabled"); --allow-cmd
actually runs a command (run("go version").success -> True)
- --caps safe withholds http (non-zero + "withheld")
- --check validates without running (valid -> 0 and the script's print never
fires; invalid syntax -> non-zero)
Full -race green; Docker golang:1.25 floor builds + runs the binary in-container.
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
The v0.1.0 cost-price audit's flagship P0 gap: no test built the real binary and ran scripts through it, so the wired modules were only load-verified, never proven to work. Add an
e2epackage whoseTestMainbuilds thestarclibinary and runs sample scripts viaexec.Command, asserting stdout and the exit code.Cases (through the real CLI)
print/ basic outputemoji(emojize→ a glyph 👋),yaml(decode),qrcode(encode().size)fail()aborts non-zero with the message on stderrrun()→ non-zero +"disabled");--allow-cmdactually runs a command (run("go version").success→True)--caps safewithholdshttp(non-zero +"withheld")--checkvalidates without running (valid →0and the script'sprintnever fires; invalid syntax → non-zero)Verification
-racegreen; Dockergolang:1.25(go floor) builds + runs the binary in-container and passes.Tracks STAR-53 P0 ② (the "最值钱" gap). Next: P0 ③ domain-module real integration (sqlite local / markdown render / gum static).