From 68c9fe765ed01aebd1223ab3b99de1373aca9c73 Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Fri, 6 Oct 2023 12:07:29 -0700 Subject: [PATCH] Also expose the void logger --- helpers.go | 4 ++-- helpers_test.go | 2 +- termtest.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helpers.go b/helpers.go index 2bb0615..3fab64b 100644 --- a/helpers.go +++ b/helpers.go @@ -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 diff --git a/helpers_test.go b/helpers_test.go index 0648842..7eef96f 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -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))...) diff --git a/termtest.go b/termtest.go index 929cea5..151918c 100644 --- a/termtest.go +++ b/termtest.go @@ -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) },