/usr/share/gocode/src/github.com/smartystreets/goconvey/reporting/init.go is in golang-github-smartystreets-goconvey-dev 1.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | package reporting
import (
"fmt"
"os"
"strings"
"github.com/smartystreets/goconvey/printing"
)
func init() {
if !isXterm() {
monochrome()
}
if isWindows() {
success, failure, error_ = dotSuccess, dotFailure, dotError
}
}
func BuildJsonReporter() Reporter {
out := printing.NewPrinter(printing.NewConsole())
return NewReporters(
NewGoTestReporter(),
NewJsonReporter(out))
}
func BuildDotReporter() Reporter {
out := printing.NewPrinter(printing.NewConsole())
return NewReporters(
NewGoTestReporter(),
NewDotReporter(out),
NewProblemReporter(out))
}
func BuildStoryReporter() Reporter {
out := printing.NewPrinter(printing.NewConsole())
return NewReporters(
NewGoTestReporter(),
NewStoryReporter(out),
NewProblemReporter(out))
}
var (
newline = "\n"
success = "✔"
failure = "✘"
error_ = "🔥"
skip = "⚠"
dotSuccess = "."
dotFailure = "x"
dotError = "E"
dotSkip = "S"
errorTemplate = "* %s \nLine %d: - %v \n%s\n"
failureTemplate = "* %s \nLine %d:\n%s\n"
)
var (
greenColor = "\033[32m"
yellowColor = "\033[33m"
redColor = "\033[31m"
resetColor = "\033[0m"
)
// QuiteMode disables all console output symbols. This is only meant to be used
// for tests that are internal to goconvey where the output is distracting or
// otherwise not needed in the test output.
func QuietMode() {
success, failure, error_, skip, dotSuccess, dotFailure, dotError, dotSkip = "", "", "", "", "", "", "", ""
}
func monochrome() {
greenColor, yellowColor, redColor, resetColor = "", "", "", ""
}
func isXterm() bool {
env := fmt.Sprintf("%v", os.Environ())
return strings.Contains(env, " TERM=isXterm") ||
strings.Contains(env, " TERM=xterm")
}
// There has got to be a better way...
func isWindows() bool {
return os.PathSeparator == '\\' && os.PathListSeparator == ';'
}
|