-
Notifications
You must be signed in to change notification settings - Fork 0
Add RequireThat #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RequireThat #47
Conversation
Code Review SummaryThis PR adds RequireThat() - a fatal assertion function that stops test execution on failure. Implementation is solid with good docs and tests. Strengths
Issues Found1. Bug: Error reporting order in RequireThat (matchers.go:100-123) Details logged BEFORE main message, but AssertThat logs them AFTER:
Fix: Log main message with Errorf(), then details, then Fatalf("") to stop. 2. Helper() call in generator.go:29 T.Helper() is intentionally a no-op (property.go:52), so calling it with comment "Mark as test helper" is misleading. Either remove it or keep for interface consistency. Minor Suggestions
Pre-merge
SummaryStrong PR. Fix error reporting order bug in RequireThat. Property test logging enhancement is particularly nice. |
1f4fcaa to
023b8f8
Compare
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
ReviewThis PR adds Code Quality: ✓Implementation (matchers.go:88-128)
Tests (matchers_test.go:328-369)
Supporting Changes
Notes
Pre-merge ChecklistPer CLAUDE.md, run:
SummaryApprove - Clean implementation, good tests, excellent documentation. No issues found. |
RequireThat checks if actual matches the given matcher, stopping the test immediately if not. Unlike AssertThat which continues after failures, RequireThat calls t.Fatalf() to halt execution. This is useful for preconditions where subsequent code would panic or produce misleading errors, such as nil checks before dereferencing. Changes: - Add RequireThat function with same signature as AssertThat - Add Fatalf method to TestingT interface - Add comprehensive tests for RequireThat behavior - Update testlib.Spy to support Fatalf testing - Add documentation with usage examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
023b8f8 to
fa32285
Compare
Code ReviewThis PR adds Code Quality ✓Implementation (matchers.go:88-128)
Tests (matchers_test.go:328-370)
Documentation
Supporting Changes
NotesThe earlier review comment about error reporting order was based on outdated information. The current implementation correctly logs the main message first (lines 109/117), then details (121-123), matching AssertThat's behavior exactly. Pre-mergePer CLAUDE.md, run:
SummaryApprove - Clean implementation, comprehensive tests, excellent documentation. Ready to merge after CI passes. |
No description provided.