Skip to content

Add runnabletest.AssertCancellation - #103

Closed
pior wants to merge 2 commits into
mainfrom
pior/v1.2/runnabletest
Closed

pior wants to merge 2 commits into
mainfrom
pior/v1.2/runnabletest

Conversation

@pior

@pior pior commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

New package runnabletest with AssertCancellation(t, r, wait). Users can check their own runnables against the cancellation contract.

  • Two subtests: cancelled while running (after 10ms), and an already-cancelled context.
  • Passes on nil or context.Canceled (matched with errors.Is, like the Manager). Fails on any other error, including context.DeadlineExceeded, and when the runnable doesn't return within wait.
  • Uses only the standard library. The failure cases are tested by running them in a child test process.
  • The internal AssertRunnableRespect* helpers stay, because package runnable tests can't import runnabletest (import cycle).

@pior
pior added this pull request to stack #104 October 6, 2026 19:41
@pior
pior force-pushed the pior/v1.2/runnabletest branch 4 times, most recently from a8d7d40 to d2051a2 Compare October 6, 2026 20:22
Base automatically changed from pior/v1.2/exponential-backoff to main October 6, 2026 21:00
@pior
pior force-pushed the pior/v1.2/runnabletest branch from 0e0c9d1 to 19468f6 Compare October 6, 2026 21:01
@pior pior closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant