Skip to content

docs(doubles): document bashunit::unmock and the double lifecycle - #908

Merged
Chemaclass merged 1 commit into
mainfrom
docs/899-document-unmock-and-double-lifecycle
Jul 27, 2026
Merged

docs(doubles): document bashunit::unmock and the double lifecycle#908
Chemaclass merged 1 commit into
mainfrom
docs/899-document-unmock-and-double-lifecycle

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #899

bashunit::unmock is public but missing from the test-doubles page, and the per-test auto-cleanup is invisible from the docs — so a reader cannot tell whether they are supposed to unmock in every tear_down.

💡 Changes

  • Document bashunit::unmock with an example, plus a "Lifecycle of a double" section: declared in a test it dies with the test, declared in set_up_before_script it lives for the whole file.
  • Add the helper and the lifecycle rule to the agent skill and the agentic-coding page.
  • Pin the documented behaviour with tests/functional/doubles_lifecycle_test.sh, so the page cannot drift.

Two corrections to the issue's framing, both verified against the runner: unmock cannot undo a set_up_before_script double for the other tests (each test is a subshell, so it only suspends it for the current one), and re-declaring a double does not need an unmock first.

bashunit::unmock was public but absent from the test-doubles page, and the
per-test auto-cleanup was invisible from the docs — leaving a reader to guess
whether they must unmock in every tear_down.

Document the helper, and state the lifecycle: a double declared in a test dies
with it, one declared in set_up_before_script lives for the whole file.

Every claim was verified against the runner rather than taken from the issue.
Two corrections to its framing: unmock cannot undo a set_up_before_script double
for the *other* tests (each test is a subshell, so it only suspends it for the
current one), and re-declaring a double does not need an unmock first — the
second mock/spy simply replaces the first.

A new tests/functional/doubles_lifecycle_test.sh pins all of it, so the page
cannot drift from the behaviour.

Closes #899
@Chemaclass Chemaclass added the documentation Improvements or additions to documentation label Jul 27, 2026
@Chemaclass Chemaclass self-assigned this Jul 27, 2026
@Chemaclass
Chemaclass merged commit 74bf0c6 into main Jul 27, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the docs/899-document-unmock-and-double-lifecycle branch July 27, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant