MCPcopy Create free account
hub / github.com/coder/agentapi / advanceUntil

Function advanceUntil

lib/screentracker/pty_conversation_test.go:73–84  ·  view source on GitHub ↗

advanceUntil advances the mock clock one event at a time until done returns true. Because the snapshot TickerFunc is always pending and WaitFor reuses a single timer via Reset, there is always at least one event to advance.

(ctx context.Context, t *testing.T, mClock *quartz.Mock, done func() bool)

Source from the content-addressed store, hash-verified

71// true. Because the snapshot TickerFunc is always pending and WaitFor reuses a
72// single timer via Reset, there is always at least one event to advance.
73func advanceUntil(ctx context.Context, t *testing.T, mClock *quartz.Mock, done func() bool) {
74 t.Helper()
75 for !done() {
76 select {
77 case <-ctx.Done():
78 t.Fatal("context cancelled waiting for condition")
79 default:
80 }
81 _, w := mClock.AdvanceNext()
82 w.MustWait(ctx)
83 }
84}
85
86// sendAndAdvance calls Send() in a goroutine and advances the mock clock until
87// Send completes.

Callers 6

advanceForFunction · 0.85
sendAndAdvanceFunction · 0.85
TestMessagesFunction · 0.85
TestStatePersistenceFunction · 0.85
TestInitialPromptSentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected