github.com/Aoi-hosizora/ahlib-more@v1.5.1-0.20230404072844-256112befaf6/xlogger/xlogger_test.go (about) 1 package xlogger 2 3 import ( 4 "testing" 5 ) 6 7 func TestStd(t *testing.T) { 8 Std().Print("test") 9 Std().Printf("%s", "test") 10 Std().Println("test") 11 func() { 12 defer func() { recover() }() 13 Std().Panic("test") 14 }() 15 func() { 16 defer func() { recover() }() 17 Std().Panicf("test") 18 }() 19 func() { 20 defer func() { recover() }() 21 Std().Panicln("test") 22 }() 23 } 24 25 func TestStdLogger(t *testing.T) { 26 var l StdLogger = Std() 27 l.Print("test") 28 l.Printf("%s", "test") 29 l.Println("test") 30 func() { 31 defer func() { recover() }() 32 l.Panic("test") 33 }() 34 func() { 35 defer func() { recover() }() 36 l.Panicf("test") 37 }() 38 func() { 39 defer func() { recover() }() 40 l.Panicln("test") 41 }() 42 }