-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprintUtils.go
50 lines (36 loc) · 892 Bytes
/
printUtils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"fmt"
"strconv"
)
func PrintRed(text string) {
fmt.Println("\033[91m" + text + "\033[0m")
}
func PrintGreen(text string) {
fmt.Println("\033[92m" + text + "\033[0m")
}
func PrintYellow(text string) {
fmt.Println("\033[93m" + text + "\033[0m")
}
func PrintWhite(text string) {
fmt.Println("\033[97m" + text + "\033[0m")
}
func PrintBoldWhite(text string) {
fmt.Println("\033[97m\033[1m" + text + "\033[0m")
}
func printSummary(numTests int, numFailedTests int, numWarnTests int) error {
PrintBoldWhite("Test Summary:")
PrintBoldWhite("=============\n")
fmt.Printf("Total: %d\n", numTests)
if numFailedTests > 0 {
PrintRed("Failed: " + strconv.Itoa(numFailedTests))
}
if numWarnTests > 0 {
PrintYellow("Warned: " + strconv.Itoa(numWarnTests))
}
fmt.Printf("\n")
if numFailedTests <= 0 {
PrintGreen("All tests passed.")
}
return nil
}