Skip to content

Commit

Permalink
Rename T to TestingT.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Jun 12, 2020
1 parent a29e951 commit d2017c6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ The format is based on [Keep a Changelog], and this project adheres to
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html

## [Unreleased]

## Changed

- **[BC]** Renamed `T` to `TestingT`, to avoid conflicts with `*testing.T` when dot-importing
- **[BC]** Renamed `assert.T` to `S`, to avoid conflicts with `*testing.T` when dot-importing

## [0.5.0] - 2020-06-11

## Added
Expand Down
2 changes: 1 addition & 1 deletion dogma.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package testkit

func log(t T, args ...interface{}) { t.Log(args...) }
func log(t TestingT, args ...interface{}) { t.Log(args...) }

// ABOUT THIS FILE (dogma.go)
//
Expand Down
8 changes: 4 additions & 4 deletions interface.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package testkit

// T is the interface via which the test framework consumes Go's *testing.T
// value.
// TestingT is the interface via which the test framework consumes Go's
// *testing.T value.
//
// It allows use of stand-ins, such as Ginkgo's GinkgoT() value.
type T interface {
type TestingT interface {
Log(args ...interface{})
Logf(f string, args ...interface{})
FailNow()
Expand All @@ -19,7 +19,7 @@ type T interface {
// See https://github.com/dogmatiq/testkit/issues/61
// See https://github.com/onsi/ginkgo/pull/585
type tHelper interface {
T
TestingT

Helper()
}
4 changes: 2 additions & 2 deletions runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func New(
}

// Begin starts a new test.
func (r *Runner) Begin(t T, options ...TestOption) *Test {
func (r *Runner) Begin(t TestingT, options ...TestOption) *Test {
return r.BeginContext(
context.Background(),
t,
Expand All @@ -43,7 +43,7 @@ func (r *Runner) Begin(t T, options ...TestOption) *Test {
}

// BeginContext starts a new test within a context.
func (r *Runner) BeginContext(ctx context.Context, t T, options ...TestOption) *Test {
func (r *Runner) BeginContext(ctx context.Context, t TestingT, options ...TestOption) *Test {
to := newTestOptions(options, r.verbose)

opts := to.operationOptions
Expand Down
2 changes: 1 addition & 1 deletion test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// Test contains the state of a single test.
type Test struct {
ctx context.Context
t T
t TestingT
verbose bool
engine *engine.Engine
now time.Time
Expand Down

0 comments on commit d2017c6

Please sign in to comment.