예제 #1
0
파일: text.go 프로젝트: h12w/gspec
// Write writes TestGroups from root to leaf.
func writeTestGroups(w io.Writer, gs ext.TestGroups, mid map[string]bool) bool {
	for i, g := range gs {
		indent := strings.Repeat("    ", i)
		if !mid[g.ID] {
			fmt.Fprintln(w, indent+g.Description)
			mid[g.ID] = true
		}
		if g.Error != nil {
			if panicError, ok := g.Error.(*ext.PanicError); ok {
				writePanicError(w, panicError)
				printFocusInstruction(w, indent, g.ID)
				//				fmt.Fprintf(w, string(panicError.SS))
				fmt.Fprintln(w, ">>> Stop printing more errors due to a panic.")
				return false
			}
			fmt.Fprintln(w, ge.Indent(g.Error.Error(), indent+"  "))
			if !isPending(g.Error) {
				printFocusInstruction(w, indent, g.ID)
			}
		}
	}
	return true
}
예제 #2
0
파일: text.go 프로젝트: h12w/gspec
func printFocusInstruction(w io.Writer, indent, id string) {
	fmt.Fprintf(w, ge.Indent(`  (use "go test -focus %s" to run the test case only.)`, indent), id)
}