diff --git a/internal/debug/debug_test.go b/internal/debug/debug_test.go index bc2b1fc5..ddb7818b 100644 --- a/internal/debug/debug_test.go +++ b/internal/debug/debug_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestPrint(t *testing.T) { +func TestLog(t *testing.T) { rescueStderr := os.Stderr r, w, _ := os.Pipe() os.Stderr = w @@ -22,3 +22,17 @@ func TestPrint(t *testing.T) { assert.Contains(t, string(output), "DEBUG: ") assert.Contains(t, string(output), "hello\n") } + +func TestLogDebugDisabled(t *testing.T) { + rescueStderr := os.Stderr + r, w, _ := os.Pipe() + os.Stderr = w + + Log("hello", false) + + _ = w.Close() + output, _ := io.ReadAll(r) + os.Stderr = rescueStderr + + assert.Empty(t, string(output)) +}