formatters

package
Version: v0.0.0-...-efc9761 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFormats

func AllFormats() []string

AllFormats returns all formats and formatters made available by this library.

Types

type FormatterFunc

type FormatterFunc = func(runtime.Results) (response []byte, formattingError error)

FormatterFunc describes a function that formats the check validation results.

type GenericFormatter

type GenericFormatter struct {
	Name          string
	FormatterFunc FormatterFunc
}

GenericFormatter represents a generic approach to formatting that implements the ResponseFormatter interface. Can be leveraged to build a custom formatter quickly.

func (*GenericFormatter) Format

func (f *GenericFormatter) Format(r runtime.Results) ([]byte, error)

func (*GenericFormatter) PrettyName

func (f *GenericFormatter) PrettyName() string

Name returns a string identification of the formatter that's in use.

type JUnitFailure

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

type JUnitProperty

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

type JUnitSkipMessage

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

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"`
	SystemOut   string            `xml:"system-out,omitempty"`
}

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"`
}

type JUnitTestSuites

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

type ResponseFormatter

type ResponseFormatter interface {
	PrettyName() string
	Format(runtime.Results) (response []byte, formattingError error)
}

ResponseFormatter describes the expected methods a formatter must implement.

func New

New returns a new formatter with the provided name and FormatterFunc.

func NewForConfig

func NewForConfig(cfg runtime.Config) (ResponseFormatter, error)

NewForConfig returns a new formatter based on the user-provided configuration. It relies on config values which should align with known/supported/built-in formatters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL