mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
Phase 1: the packages with no project dependencies move first, so every later phase builds on finished leaves; the goldens pin the behavior.
26 lines
822 B
Go
26 lines
822 B
Go
package log
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSetLevel(t *testing.T) {
|
|
t.Cleanup(func() { SetLevel(InfoLevel) }) // restore package default
|
|
|
|
SetLevel(FatalLevel)
|
|
assert.False(t, defaultLogger.canLogAt(InfoLevel), "Info must be suppressed at FatalLevel")
|
|
assert.False(t, defaultLogger.canLogAt(WarnLevel), "Warn must be suppressed at FatalLevel")
|
|
assert.False(t, defaultLogger.canLogAt(ErrorLevel), "Error must be suppressed at FatalLevel")
|
|
assert.True(t, defaultLogger.canLogAt(FatalLevel), "Fatal must still log at FatalLevel")
|
|
|
|
SetVerbose()
|
|
assert.True(t, defaultLogger.canLogAt(DebugLevel), "SetVerbose must enable Debug")
|
|
}
|
|
|
|
func TestSetLevelInvalidPanics(t *testing.T) {
|
|
t.Cleanup(func() { SetLevel(InfoLevel) })
|
|
assert.Panics(t, func() { SetLevel(FatalLevel + 1) })
|
|
}
|