Files
HackBrowserData/internal/log/log_test.go
T
Roger 4e98ba7884 fix: report unreadable sources and tidy the pipeline (#675)
A Stat error other than not-exist was reported as absent, and the --zip archive was readable by other users.
The rest is review follow-up: export no longer prints, one runner type, shared name helpers, a trimmed log API.
2026-11-01 23:42:13 +08:00

23 lines
609 B
Go

package log
import (
"io"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSetVerbose(t *testing.T) {
t.Cleanup(func() { defaultLogger.SetLevel(InfoLevel) }) // restore package default
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) })
}