Files
HackBrowserData/internal/log/log_test.go
T
Roger 0ed920f846 docs: trim code comments to the why (#676)
Comments that restated names or narrated the code are gone, and multi-line ones are cut to a line of why.
Only comments change: each edited Go file has the same token stream as before. winapi and abe come later.
2026-11-02 00:03:03 +08:00

23 lines
582 B
Go

package log
import (
"io"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSetVerbose(t *testing.T) {
t.Cleanup(func() { defaultLogger.SetLevel(InfoLevel) })
assert.False(t, defaultLogger.canLogAt(DebugLevel), "Debug must be suppressed by default")
SetVerbose()
assert.True(t, defaultLogger.canLogAt(DebugLevel), "SetVerbose must enable Debug")
}
func TestSetLevelInvalidPanics(t *testing.T) {
logger := NewLogger(newBase(io.Discard))
assert.Panics(t, func() { logger.SetLevel(DebugLevel - 1) })
assert.Panics(t, func() { logger.SetLevel(WarnLevel + 1) })
}