Skip to content

Conversation

@mafredri
Copy link
Member

@mafredri mafredri commented Oct 31, 2025

Thought it'd be nice to improve the trap logging slightly to give more context:

Before:

=== RUN   Test_UnreleasedCalls
=== PAUSE Test_UnreleasedCalls
=== CONT  Test_UnreleasedCalls
    mock.go:442: Mock Clock - Trap Now(..., [])
    mock.go:196: Mock Clock - Now([]) call, matched 1 traps
    mock_test.go:408: trap Closed() with 1 unreleased calls
    mock.go:484: Mock Clock - test cleanup; will no longer log clock events
--- PASS: Test_UnreleasedCalls (0.00s)
PASS
ok      github.com/coder/quartz 0.004s

After:

=== RUN   Test_UnreleasedCalls
=== PAUSE Test_UnreleasedCalls
=== CONT  Test_UnreleasedCalls
    mock.go:442: Mock Clock - Trap Now(..., [])
    mock.go:196: Mock Clock - Now([]) call, matched 1 traps
    mock_test.go:408: trap Now(..., []) Closed() with 1 unreleased calls
    mock_test.go:411: trap Now(..., []) already Closed()
    mock.go:484: Mock Clock - test cleanup; will no longer log clock events
--- PASS: Test_UnreleasedCalls (0.00s)
PASS
ok      github.com/coder/quartz 0.003s

Added a log to select from #24, hence this PR is targeting that one.

@mafredri mafredri requested a review from spikecurtis October 31, 2025 12:17
@mafredri mafredri force-pushed the mafredri/improve-trap-logging branch from fd0fb38 to f5c86b9 Compare October 31, 2025 13:49
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