formatters

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFormatter  = "default"
	JsonFormatter     = "json"
	TeamcityFormatter = "teamcity"
)
View Source
const (
	JsonTestEventActionRun    = "run"    // the test has started running
	JsonTestEventActionPause  = "pause"  //  the test has been paused
	JsonTestEventActionCount  = "cont"   //  the test has continued running
	JsonTestEventActionPass   = "pass"   //  the test passed
	JsonTestEventActionBench  = "bench"  //  the benchmark printed log output but did not fail
	JsonTestEventActionFail   = "fail"   //  the test or benchmark failed
	JsonTestEventActionOutput = "output" //  the test printed output
	JsonTestEventActionSkip   = "skip"   //  the test was skipped or the package contained no tests
)

https://github.com/golang/go/blob/master/src/cmd/test2json/main.go

View Source
const (
	TeamcityTimestampFormat = "2006-01-02T15:04:05.000"
)

Variables

This section is empty.

Functions

func DefaultOutput

func DefaultOutput(prefix, label, funcPath, funcName, suffix string) string

func JsonOutput

func JsonOutput(status string, testName, stdOut string, startTime time.Time, testDuration time.Duration,
	funcPath string) string

{"Time":"2022-05-26T13:59:39.562101-04:00","Action":"output","Package":"","Test":"TestService","Output":"OK: 1 passed\n"}

func Render

func Render(d Data) string

func TeamcityOutput

func TeamcityOutput(status string, testName, stdOut string, startTime time.Time, testDuration time.Duration,
	formatMessageNamePrefixFlag string, details ...string) string

Types

type Data

type Data struct {
	StartTime time.Time
	Duration  time.Duration

	TestName string
	StdOut   string
	FuncPath string
	Package  string
	FuncName string
	Prefix   string
	Label    string
	Suffix   string

	Formatter    Formatter
	FormatPrefix string
}

type Formatter

type Formatter string

func F

func F(name *string) Formatter

type JsonTestEvent

type JsonTestEvent struct {
	Time    string // encodes as an RFC3339-format string
	Action  JsonTestEventAction
	Package string
	Test    string
	Elapsed float64 // seconds
	Output  string
}

type JsonTestEventAction

type JsonTestEventAction string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL