Documentation
¶
Overview ¶
Package formatters defines the abstractions used to properly format a preflight Result.
Index ¶
Constants ¶
View Source
const (
DefaultFormat = "json"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JUnitMessage ¶
type JUnitProperty ¶
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 *JUnitMessage `xml:"failure,omitempty"`
Warning *JUnitMessage `xml:"warning,omitempty"`
SystemOut string `xml:"system-out,omitempty"`
Message string `xml:",chardata"`
}
type JUnitTestSuite ¶
type JUnitTestSuite struct {
XMLName xml.Name `xml:"testsuite"`
Tests int `xml:"tests,attr"`
Failures int `xml:"failures,attr"`
Warnings int `xml:"warnings,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 is the name used to represent this formatter.
PrettyName() string
// FileExtension represents the file extension one might use when creating
// a file with the contents of this formatter.
FileExtension() string
// Format takes Results, formats it as needed, and returns the formatted
// results ready to write as a byte slice.
Format(context.Context, certification.Results) (response []byte, formattingError error)
}
ResponseFormatter describes the expected methods a formatter must implement.
func New ¶
func New(name, extension string, fn formatters.FormatterFunc) (ResponseFormatter, error)
New returns a new formatter with the provided name and FormatterFunc.
func NewByName ¶
func NewByName(name string) (ResponseFormatter, error)
NewByName returns a predefined ResponseFormatter with the given name. TODO: New* funcs in this package may benefit from renaming.
func NewForConfig ¶
func NewForConfig(cfg config.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.
type UserResponse ¶
type UserResponse struct {
Image string `json:"image" xml:"image"`
Passed bool `json:"passed" xml:"passed"`
CertificationHash string `json:"certification_hash,omitempty" xml:"certification_hash,omitempty"`
LibraryInfo version.VersionContext `json:"test_library" xml:"test_library"`
Results resultsText `json:"results" xml:"results"`
}
UserResponse is the standard user-facing response.
Click to show internal directories.
Click to hide internal directories.