Repository navigation
Pass *testing.T to the functions of the builders - #26
Merged
Merged
Conversation
The functions given to Connector and Conn of DBBuilder and SessionBuilder now take the test the session was opened for as their first argument, so that a function shared by tests, such as one on a SessionBuilder made before the tests run, can report failures without panicking. This is a breaking change. The samples in the README no longer use testify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
=======================================
Coverage 92.47% 92.47%
=======================================
Files 7 7
Lines 425 425
=======================================
Hits 393 393
Misses 17 17
Partials 15 15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ConnectorandConnofDBBuilderandSessionBuildernow take a*testing.Tas their first argument, so a function shared by tests, such as one on aSessionBuildermade before the tests run, can report failures without panicking.tis always the test the session was opened for. When a subtest callss.With().Conn(...).DB()on its parent's session, the function gets the parent'st, so callingFailNowon it from the subtest does not work properly. Such a function should use the subtest'stfrom its closure.DBBuilder.ConnandTxResultsones.Test plan
go vet ./...make test(go test -v -race -count=1 ./...)golangci-lint run