Пример #1
0
func (list *List) Next(test execute.TestResponse) {
	if len(test.Results) == 0 {
		fmt.Printf("%v %v ⇒ (no results)\n", blue("∅"), fmtTestCase(test.TestCase))
		return
	}

	if len(test.Results) == 1 {
		result := test.Results[0]
		fmt.Printf("%v %v ⇒ %v\n", statusToColoredSymbol(result.Status),
			fmtTestCase(test.TestCase), result.Output)
		return
	}

	bs := test.SummarizeStatus()

	fmt.Printf("%v %v (%v/%v passed, %v/%v skipped)\n",
		statusToColoredSymbol(bs.Status), fmtTestCase(test.TestCase),
		bs.Passed, bs.Total-bs.Skipped, bs.Skipped, bs.Total)

	for idx, result := range test.Results {
		prefix := "├"
		if idx == bs.Total-1 {
			prefix = "└"
		}
		fmt.Printf("   %v %v ⇒ %v\n", prefix,
			statusToColoredSymbol(result.Status), result.Output)
	}
}
Пример #2
0
func (compact *Compact) Next(test execute.TestResponse) {
	if len(test.Results) == 0 {
		compact.printf("%v %v ⇒ (no results)\n", blue("∅"), fmtTestCase(test.TestCase))
		return
	}

	if len(test.Results) == 1 {
		result := test.Results[0]
		if result.Status != execute.Failed {
			compact.printDot(result.Status)
		} else {
			compact.printf("%v %v ⇒ %v\n", statusToColoredSymbol(result.Status),
				fmtTestCase(test.TestCase), result.Output)
		}
		return
	}

	bs := test.SummarizeStatus()

	if bs.Status != execute.Failed {
		compact.printDot(bs.Status)
		return
	}

	compact.printf("%v %v (%v/%v passed, %v/%v skipped)\n",
		statusToColoredSymbol(bs.Status), fmtTestCase(test.TestCase),
		bs.Passed, bs.Total-bs.Skipped, bs.Skipped, bs.Total)

	for idx, result := range test.Results {
		if result.Status != execute.Failed {
			compact.printDot(result.Status)
			continue
		}
		prefix := "├"
		if idx == bs.Total-1 {
			prefix = "└"
		}
		compact.printf("   %v %v ⇒ %v\n", prefix,
			statusToColoredSymbol(result.Status), result.Output)
	}
}