console

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 76

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Light       = ";1m"
	Bright      = ";40m"
	Normal      = "m"
	Reset       = "\x1b[0m"
	LightYellow = yellow + Light

	Red = red + Normal

	Yellow = yellow + Normal

	Gray       = gray + Normal
	LightGray  = gray + Light
	BrightGray = gray + Bright
	LightRed   = red + Light

	Green      = green + Normal
	LightGreen = green + Light

	BrightYellow = yellow + Bright

	Blue      = blue + Normal
	LightBlue = blue + Light

	Magenta       = magenta + Normal
	LightMagenta  = magenta + Light
	BrightMagenta = magenta + Bright

	Cyan       = cyan + Normal
	LightCyan  = cyan + Light
	BrightCyan = cyan + Bright

	White       = white + Light
	BoldOn      = "\x1b[1m"
	BoldOff     = "\x1b[22m"
	DarkWhite   = "\x1b[38;5;244m"
	BrightWhite = "\x1b[38;5;244m"
)

Functions

func Bluef added in v1.2.0

func Bluef(msg string, args ...interface{}) string

Bluef prints and formats msg as red text

func BrightBluef added in v1.5.1

func BrightBluef(msg string, args ...interface{}) string

BrightBluef prints and formats msg as red text

func BrightCyanf added in v1.5.1

func BrightCyanf(msg string, args ...interface{}) string

LightCyanf prints and formats msg as light cyan text

func BrightF added in v1.5.1

func BrightF(msg string, args ...interface{}) string

DarkWhitef prints and formats msg as dark white

func BrightGrayf added in v1.5.1

func BrightGrayf(msg string, args ...interface{}) string

BrightGrayf prints and formats msg as red text

func BrightGreenf added in v1.5.1

func BrightGreenf(msg string, args ...interface{}) string

BrightGreenf prints and formats msg as light green text

func BrightMagentaf added in v1.5.1

func BrightMagentaf(msg string, args ...interface{}) string

Magentaf prints and formats msg as green text

func BrightWhitef added in v1.5.1

func BrightWhitef(msg string, args ...interface{}) string

DarkWhitef prints and formats msg as dark white

func BrightYellowf added in v1.5.1

func BrightYellowf(msg string, args ...interface{}) string

BrightYellowf prints and formats msg as red text

func ColorOff added in v1.20.1

func ColorOff()

func Cyanf added in v1.5.1

func Cyanf(msg string, args ...interface{}) string

LightCyanf prints and formats msg as light cyan text

func DarkF added in v1.2.0

func DarkF(msg string, args ...interface{}) string

DarkWhitef prints and formats msg as dark white

func DarkWhitef added in v1.5.1

func DarkWhitef(msg string, args ...interface{}) string

DarkWhitef prints and formats msg as dark white

func Grayf added in v1.2.0

func Grayf(msg string, args ...interface{}) string

Grayf prints and formats msg as red text

func Greenf

func Greenf(msg string, args ...interface{}) string

Greenf prints and formats msg as green text

func LightBluef added in v1.5.1

func LightBluef(msg string, args ...interface{}) string

LightBluef prints and formats msg as red text

func LightCyanf

func LightCyanf(msg string, args ...interface{}) string

LightCyanf prints and formats msg as light cyan text

func LightGrayf added in v1.5.1

func LightGrayf(msg string, args ...interface{}) string

LightGrayf prints and formats msg as red text

func LightGreenf

func LightGreenf(msg string, args ...interface{}) string

LightGreenf prints and formats msg as light green text

func LightMagentaf added in v1.5.1

func LightMagentaf(msg string, args ...interface{}) string

Magentaf prints and formats msg as green text

func LightRedf added in v1.2.0

func LightRedf(msg string, args ...interface{}) string

LightRedf prints and formats msg as red text

func LightWhitef added in v1.5.1

func LightWhitef(msg string, args ...interface{}) string

DarkWhitef prints and formats msg as dark white

func LightYellowf added in v1.5.1

func LightYellowf(msg string, args ...interface{}) string

LightYellowf prints and formats msg as red text

func Magentaf added in v1.2.0

func Magentaf(msg string, args ...interface{}) string

Magentaf prints and formats msg as green text

func Redf

func Redf(msg string, args ...interface{}) string

Redf prints and formats msg as red text

func StripSecrets

func StripSecrets(text string) string

StripSecrets takes a YAML or INI formatted text and removes any potentially secret data as denoted by keys containing "pass" or "secret" or exact matches for "key" the last character of the secret is kept to aid in troubleshooting

func Yellowf added in v1.2.0

func Yellowf(msg string, args ...interface{}) string

Yellowf prints and formats msg as red text

Types

type JUnitFailure

type JUnitFailure struct {
	Message  string `xml:"message,attr"`
	Type     string `xml:"type,attr"`
	Contents string `xml:",chardata"`
}

JUnitFailure contains data related to a failed test.

type JUnitProperty

type JUnitProperty struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

JUnitProperty represents a key/value pair used to define properties.

type JUnitSkipMessage

type JUnitSkipMessage struct {
	Message string `xml:"message,attr"`
}

JUnitSkipMessage contains the reason why a testcase was skipped.

type JUnitTestCase

type JUnitTestCase struct {
	XMLName     xml.Name          `xml:"testcase"`
	Classname   string            `xml:"classname,attr"`
	Name        string            `xml:"name,attr"`
	Time        string            `xml:"time,attr"`
	SkipMessage *JUnitSkipMessage `xml:"skipped,omitempty"`
	Failure     *JUnitFailure     `xml:"failure,omitempty"`
}

JUnitTestCase is a single test case with its result.

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName    xml.Name        `xml:"testsuite"`
	Tests      int             `xml:"tests,attr"`
	Failures   int             `xml:"failures,attr"`
	Time       string          `xml:"time,attr"`
	Name       string          `xml:"name,attr"`
	Properties []JUnitProperty `xml:"properties>property,omitempty"`
	TestCases  []JUnitTestCase `xml:"testcase"`
}

JUnitTestSuite is a single JUnit test suite which may contain many testcases.

type JUnitTestSuites

type JUnitTestSuites struct {
	XMLName xml.Name         `xml:"testsuites"`
	Suites  []JUnitTestSuite `xml:"testsuite"`
}

JUnitTestSuites is a collection of JUnit test suites.

func (JUnitTestSuites) ToXML

func (suites JUnitTestSuites) ToXML() (string, error)

type Progress added in v1.2.0

type Progress interface {
	Done()
	Status(status string)
	Start()
}

func NewTextProgress added in v1.2.0

func NewTextProgress(name string, localTest *TestResults) Progress

type TestResults

type TestResults struct {
	PassCount int
	FailCount int
	SkipCount int
	Tests     []JUnitTestCase
	Name      string
	Writer    io.Writer
	Retries   int
}

TestResults contains the status of testing

func NewTestResults added in v1.2.0

func NewTestResults(name string, writer io.Writer) TestResults

func (*TestResults) Append added in v1.2.0

func (c *TestResults) Append(other *TestResults)

func (*TestResults) Assert added in v1.5.1

func (c *TestResults) Assert(name string, expect, actual interface{})

func (*TestResults) Debugf added in v1.2.0

func (c *TestResults) Debugf(s string, args ...interface{})

func (*TestResults) Done

func (c *TestResults) Done()

Done prints the test results to stdout

func (*TestResults) Errorf added in v1.2.0

func (c *TestResults) Errorf(s string, args ...interface{})

func (*TestResults) Failf

func (c *TestResults) Failf(name, msg string, args ...interface{})

Failf reports a new failing test

func (*TestResults) Infof added in v1.2.0

func (c *TestResults) Infof(s string, args ...interface{})

func (*TestResults) Passf

func (c *TestResults) Passf(name, msg string, args ...interface{})

Passf reports a new passing test

func (*TestResults) Printf added in v1.2.0

func (c *TestResults) Printf(s string, args ...interface{})

func (*TestResults) Println added in v1.2.0

func (c *TestResults) Println(s string)

func (*TestResults) Retry added in v1.2.0

func (c *TestResults) Retry()

func (*TestResults) Skipf

func (c *TestResults) Skipf(name, msg string, args ...interface{})

Skipf reports a new skipped test

func (TestResults) String

func (c TestResults) String() string

func (*TestResults) SuiteName

func (c *TestResults) SuiteName(name string) *TestResults

func (TestResults) ToXML

func (c TestResults) ToXML() (string, error)

func (*TestResults) Tracef added in v1.2.0

func (c *TestResults) Tracef(s string, args ...interface{})

func (*TestResults) Warnf added in v1.2.0

func (c *TestResults) Warnf(s string, args ...interface{})

Jump to

Keyboard shortcuts

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