Skip to content

Commit

Permalink
Also expose the void logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Naatan committed Oct 6, 2023
1 parent 7239daa commit 68c9fe7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"time"
)

type voidWriter struct{}
type VoidLogger struct{}

func (v voidWriter) Write(p []byte) (n int, err error) { return len(p), nil }
func (v VoidLogger) Write(p []byte) (n int, err error) { return len(p), nil }

var neverGonnaHappen = time.Hour * 24 * 365 * 100

Expand Down
2 changes: 1 addition & 1 deletion helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newTermTest(t *testing.T, cmd *exec.Cmd, logging bool, opts ...SetOpt) *Ter
tt, err := New(cmd, append(opts, func(o *Opts) error {
o = newTestOpts(o, t)
if !logging {
o.Logger = log.New(voidWriter{}, "TermTest: ", log.LstdFlags)
o.Logger = log.New(VoidLogger{}, "TermTest: ", log.LstdFlags)
}
return nil
}, OptTestErrorHandler(t))...)
Expand Down
2 changes: 1 addition & 1 deletion termtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const DefaultRows = 10

func NewOpts() *Opts {
return &Opts{
Logger: log.New(voidWriter{}, "TermTest: ", log.LstdFlags|log.Lshortfile),
Logger: log.New(VoidLogger{}, "TermTest: ", log.LstdFlags|log.Lshortfile),
ExpectErrorHandler: func(_ *TermTest, err error) error {
panic(err)
},
Expand Down

0 comments on commit 68c9fe7

Please sign in to comment.