示例#1
0
文件: testV2.go 项目: keysonZZZ/kmg
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
文件: testV2.go 项目: keysonZZZ/kmg
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)
}