1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
package mlog
import (
"io"
"testing"
)
func TestFlagSet(t *testing.T) {
logger := New(io.Discard, 0)
expected := Ltimestamp | Ldebug
logger.SetFlags(expected)
flags := logger.Flags()
t.Log(flags)
if flags&(expected) == 0 {
t.Errorf("flags did not match\n%12s %#v\n%12s %#v",
"expected:", expected.GoString(),
"actual:", flags.GoString())
}
expected = Ltimestamp | Llongfile
logger.SetFlags(expected)
flags = logger.Flags()
if flags&(expected) == 0 {
t.Errorf("flags did not match\n%12s %#v\n%12s %#v",
"expected:", expected.GoString(),
"actual:", flags.GoString())
}
}
|