func Ok(expectTrue bool, objList ...interface{}) { if !expectTrue { if len(objList) == 0 { panic("ok fail") } else { panic("ok fail\n" + kmgDebug.Sprintln(objList...)) } } }
func TestSprintln(ot *testing.T) { kmgTest.Equal(kmgDebug.Sprintln([]byte{0, 1}), "[kmgDebug.Println] [0 1]\n") kmgTest.Equal(kmgDebug.Sprintln([]byte{}), "[kmgDebug.Println] []\n") kmgTest.Equal(kmgDebug.Sprintln([]byte(nil)), "[kmgDebug.Println] nil\n") }
func Equal(get interface{}, expect interface{}, objList ...interface{}) { if isEqual(expect, get) { return } var msg string if len(objList) == 0 { msg = fmt.Sprintf("\tget1: %s\n\texpect2: %s", valueDetail(get), valueDetail(expect)) } else { msg = fmt.Sprintf("\tget1: %s\n\texpect2: %s\n%s", valueDetail(get), valueDetail(expect), kmgDebug.Sprintln(objList...)) } panic(msg) }