Пример #1
0
func Ok(expectTrue bool, objList ...interface{}) {
	if !expectTrue {
		if len(objList) == 0 {
			panic("ok fail")
		} else {
			panic("ok fail\n" + kmgDebug.Sprintln(objList...))
		}
	}
}
Пример #2
0
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")
}
Пример #3
0
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)
}