feat: ilo test subcommand for -- run: / -- out: assertions#569
Merged
Conversation
Surfaces the in-tree -- run: / -- out: / -- err: annotation format as a user-facing command. The same format that tests/examples_engines.rs already exercises, exposed so end-user programs and test suites can assert behaviour from the same files agents read as in-context examples. ilo test <file> runs one file; ilo test <dir> walks .ilo files recursively. Each case spawns the current ilo binary with the chosen engine flag (defaults to --vm; --engine jit / --engine all widen the matrix), asserts stdout (-- out:) or stderr (-- err:) against the expected payload, and prints PASS / FAIL with the source line. Final line is N passed, M failed; exit 0 on all-pass, 1 otherwise. The runner lives in src/cli/test_runner.rs, dispatched from main on Cmd::Test. Path defaults to examples/ when omitted so ilo test in a fresh checkout does something useful out of the box.
Seven subprocess tests pin the dispatch path: passing case, failing case (exit 1 + FAIL line), -- err: assertion shape, directory recursion, --engine all running both engines, missing-path error, and no-annotations-found error. Each spawns the ilo binary so the test exercises real CLI parsing + the runner's own subprocess fan-out, two layers deep.
SPEC.md gains the CLI invocation line in the inventory plus a full **ilo test** paragraph next to ilo check, covering engine selection, the -- engine-skip: passthrough, and the all-pass / any-fail exit codes. ai.txt gets the matching agent-spec entry inline. The skill's ilo-agent.md gets a Testing section with the three canonical invocations so an agent writing tests for its own programs sees the shape without round-tripping to SPEC.
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
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.
Summary
Pending #52: a user-facing
ilo testsubcommand that runs the same-- run:/-- out:/-- err:annotation formattests/examples_engines.rsalready uses.Manifesto framing: every
.iloexample in the repo already carries embedded assertions and the integration harness runs them. Surfacing that same format asilo testmeans end-user programs and agent-written test suites can assert behaviour the same way examples do, with zero new syntax to learn. Token win: one annotation pattern covers in-repo examples, agent docs, and user tests.Repro
Before: an agent writing tests for its own ilo program had no in-language test runner. The closest thing was hand-rolled bash scripts piping
ilo <file>intodiff, or copying the Rust integration harness verbatim.After:
ilo test examples/runs every example in the repo as a smoke test (~ same set the integration harness covers).What's in the diff
src/cli/test_runner.rs(new) implements the file/directory walker, annotation parser (parse_cases/parse_engine_skips), engine selector (vm/jit/all), and subprocess fan-out.Cmd::Test(TestArgs)added tosrc/cli/args.rs; dispatch wired insrc/main.rs. Path defaults toexamples/when omitted.ilobinary so the test exercises real CLI parsing + the runner's own subprocess fan-out.**ilo test**paragraph next toilo check. ai.txt agent-spec entry inline.skills/ilo/ilo-agent.mdTesting section with the three canonical invocations.Test plan
cargo test --release --features cranelift --test cli_test_cmd- 7 passingcargo fmt && cargo clippy --release --features cranelift --all-targets -- -D warnings- cleanregression_reserved_names_doc::spec_reserved_short_names_match_builtin_registry(b64/hex SPEC drift, unrelated to this PR)ilo test examples/walks the examples dir and reports per-file PASS/FAILFollow-ups
--jsonoutput mode in a follow-up if agents want a machine-parseable summary instead of the human PASS/FAIL lines.