forked from fl00r/go-tarantool-1.6
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Refactor the test_helpers package to accept a custom T interface instead of concrete *testing.T. This makes test utilities reusable in examples, benchmarks, or custom test runners.
Types like MockDoer and MockResponse depend directly on *testing.T:
func NewMockDoer(t *testing.T, ...) *MockDoerThis tightly couples helpers to the testing package, preventing their use in:
- Example functions (
ExampleXxx) - Custom test frameworks
- Non-
*testing.Tcontexts (e.g., internal validation tools)
Define a minimal interface that captures only the methods we actually use:
// T is a subset of *testing.T used for test helpers.
type T interface {
Helper()
Fatalf(format string, args ...interface{})
Errorf(format string, args ...interface{})
}Then update all functions in test_helpers to accept T instead of *testing.T.
Checklist
- Add the
Tinterface intest_helpers(e.g., intest_helpers/types.go). - Update all helper functions and structs (
MockDoer,MockResponse, etc.) to useT. - Update existing tests to still pass
*testing.T(it satisfiesTautomatically). - Modify CHANGELOG.md and MIGRATION.md accordingly
Metadata
Metadata
Assignees
Labels
No labels