Skip to content

Commit

Permalink
util: simplify Helper calls
Browse files Browse the repository at this point in the history
  • Loading branch information
brandondyck authored and shoenig committed Aug 29, 2024
1 parent 9448f37 commit 0457f01
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions util/tempfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type helperTracker struct {
}

func (t *helperTracker) TempDir() string {
t.t.Helper()
t.Helper()
return t.t.TempDir()
}

Expand All @@ -36,17 +36,17 @@ func (t *helperTracker) Helper() {
}

func (t *helperTracker) Errorf(s string, args ...any) {
t.t.Helper()
t.Helper()
t.t.Errorf(s, args)
}

func (t *helperTracker) Fatalf(s string, args ...any) {
t.t.Helper()
t.Helper()
t.t.Fatalf(s, args...)
}

func (t *helperTracker) Cleanup(f func()) {
t.t.Helper()
t.Helper()
t.t.Cleanup(f)
}

Expand All @@ -61,7 +61,7 @@ type failureTracker struct {
}

func (t *failureTracker) TempDir() string {
t.t.Helper()
t.Helper()
return t.t.TempDir()
}

Expand All @@ -70,24 +70,24 @@ func (t *failureTracker) Helper() {
}

func (t *failureTracker) Errorf(s string, args ...any) {
t.t.Helper()
t.Helper()
t.failed = true
fmt.Fprintf(&t.log, s+"\n", args...)
}

func (t *failureTracker) Fatalf(s string, args ...any) {
t.t.Helper()
t.Helper()
t.failed = true
fmt.Fprintf(&t.log, s+"\n", args...)
}

func (t *failureTracker) Cleanup(f func()) {
t.t.Helper()
t.Helper()
t.t.Cleanup(f)
}

func (t *failureTracker) AssertFailedWith(msg string) {
t.t.Helper()
t.Helper()
if !t.failed {
t.t.Fatalf("expected test to fail with message %q", msg)
}
Expand Down

0 comments on commit 0457f01

Please sign in to comment.