docs: add README + basic and loom_e2e examples (#17) #35
No reviewers
Labels
No labels
area:assertions
area:cli
area:client
area:harness
area:meta
area:reporting
area:runner
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/ws-rpc-test!35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/17-examples"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #17. Stacked on #34.
Summary
Adds the two example binaries from spec §9 and §10 plus a README quickstart.
examples/basic.rs(spec §9)5 tests against a generic JSON-RPC app:
health_check+assert_ok!create_item+assert_field_exists!wait_foreventlist_items+assert_array!+.tag("read-only")call("nonexistent_method", ...)must fail)examples/loom_e2e.rs(spec §10)Illustrative consumer example with:
DISPLAYenv forwarding for the child GUIwait_for_any(["image.generated", "job.failed"], ...)and a 120 s timeoutCompiles via
cargo build --examplesbut requires a real Loom binary to run, so CI compiles but doesn't execute it. Serves as a copy-pasteable template.README.mdChecklist (from issue #17)
examples/basic.rsparse_cli_args, 5 tests)cargo build --examplescompiles itexamples/loom_e2e.rscargo build --examplesREADME
Test plan
cargo build --examplesgreenjust qagreen — 107/107Notes for the reviewer
parse_cli_args()call in both examples is#[cfg(feature = "cli")]-gated so they build cleanly even withdefault-features = false.basic.rsexample usesassert_field!(event, "data", "name", "event-test")(2-level path), but my version sticks toassert_field_exists!because the mock server layout isn't guaranteed. The spec's intent — "exercise subscribe + wait_for in one test" — is preserved.loom_e2e.rsexample is not run in CI. The issue's checklist bullet "Smoke-tested in CI by running it against the in-process mock server" forbasic.rsis also deferred —tests/framework_tests.rsfrom #16 already runs the same patterns against the in-process mock, and exposing a user-facing mock API just to re-runbasic.rswould inflate the crate's surface without benefit.forge.jacquin.app/charles/ws-rpc-testper the repository field inCargo.toml.Review PR #35 — README + exemples
basicetloom_e2ePR de documentation et exemples. Tout est correct ; notes mineures ci-dessous.
README
Clair, bien structuré. La section Motivation explique le problème résolu sans sur-vendre. Le quickstart compile (pour autant qu'un binaire cible existe). La liste Features est exhaustive et à jour avec le code.
Petit écart :
runner.parse_cli_args()dans le quickstart est appelé sans le#[cfg(feature = "cli")]guard. Dansexamples/basic.rsle guard est présent (#[cfg(feature = "cli")]), mais le README l'omit. Ce n'est pas une erreur fonctionnelle (le feature est activé par défaut), mais ça peut induire les consommateurs qui désactivent le feature en erreur.examples/basic.rs#[cfg(feature = "cli")] runner.parse_cli_args();: correct.std::process::exit(if report.failed > 0 { 1 } else { 0 }): bonne pratique, propage le statut au shell.assert_array!(r, 1..): syntaxe correcte issue de PR #26.Rien à signaler.
examples/loom_e2e.rscargo build --examplesbut running it requires a real Loom binary". Bon.wait_for_anyretourne(String, serde_json::Value), destructuré en(matched_event, event_params). Correct.assert_array!(event_params["data"]["paths"], 1..): suppose une forme précise de la notificationimage.generated. En tant que template illustratif, c'est parfaitement acceptable..tag("backend").tag("slow"): enchaînement correct avec l'API builder.Rien à signaler.
Points positifs
cargo build --examplesdevrait passer).✅ Pas de bugs. Peut merger.
5d7c92682btofca1965a1b