Skip to content

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Apr 15, 2025

  • Rename RequireRecvCtx to TryReceive
  • Rename RequireSendCtx to RequireSend
  • Remove unused AssertSendCtx
  • Add RequireReceive function that will fail the test if the chan is closed

These new names more clearly describe their functionality.

  • The primary purpose of these helpers doesn't actually center around contexts, and mostly uses them as a way to cancel the channel read if the test times out.
  • RequireRecvCtx as it was implemented didn't actually require that you could read a value from the chan. It would just return a zero value if the chan was closed.
  • The new RequireReceive properly requires that a value is received from the chan.

@brettkolodny
Copy link
Contributor

Initially a scary amount of changes but looks good to me!

@aslilac aslilac merged commit f670bc3 into main Apr 16, 2025
29 checks passed
@aslilac aslilac deleted the lilac/testutil-chan branch April 16, 2025 16:37
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy