results

package
v0.0.0-...-587aff0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is the states of the tests

const (
	Run      Action = "run"
	Pass     Action = "pass"
	Fail     Action = "fail"
	Skip     Action = "skip"
	Continue Action = "cont"
	Pause    Action = "pause"
	Output   Action = "output"
)

type BuildError

type BuildError struct {
	Package string `json:"package,omitempty"`
	Path    string `json:"path,omitempty"`
	Line    int64  `json:"line,omitempty"`
	Column  int64  `json:"column,omitempty"`
	Have    string `json:"have,omitempty"`
	Want    string `json:"want,omitempty"`
	Message string `json:"message"`
	Raw     string `json:"raw"`
}

BuildError captures a single build error in a package

func (*BuildError) Excerpt

func (line *BuildError) Excerpt() *Excerpt

Excerpt generates the data needed to display a code snippet of where a build error occurred

type Excerpt

type Excerpt struct {
	Before    *ExcerptLine
	Highlight *ExcerptHighlightLine
	After     *ExcerptLine
}

Excerpt is a generated structure that captures where an error happened

type ExcerptHighlightLine

type ExcerptHighlightLine struct {
	Line, Prefix, Highlight, Suffix string
}

ExcerptHighlightLine is the target of the excerpt

type ExcerptLine

type ExcerptLine struct {
	Line, Code string
}

ExcerptLine are lines around an excerpt

type Failure

type Failure struct {
	Name       string           `json:"failure,omitempty"`
	Package    string           `json:"package,omitempty"`
	File       string           `json:"file,omitempty"`
	Line       int              `json:"line,omitempty"`
	Messages   []string         `json:"messages,omitempty"`
	Diff       *TestifyDiff     `json:"diff,omitempty"`
	IsPanic    bool             `json:"IsPanic,omitempty"`
	PanicTrace []PanicTraceLine `json:"panic_trace,omitempty"`
	// contains filtered or unexported fields
}

Failure is a single test failure message

type Package

type Package struct {
	Summary
	Name            string           `json:"name"`
	Tests           map[string]*Test `json:"tests,omitempty"`
	State           Action           `json:"state"`
	Cached          bool             `json:"cached,omitempty"`
	StatementCount  int64            `json:"statements,omitempty"`
	CoveredCount    int64            `json:"covered,omitempty"`
	CoveragePercent float64          `json:"percent,omitempty"`
	// contains filtered or unexported fields
}

Package is the test results for a single package

func (Package) Elapsed

func (watch Package) Elapsed() time.Duration

type PanicTraceLine

type PanicTraceLine struct {
	Fn   string `json:"fn,omitempty"`
	Line int    `json:"line,omitempty"`
	Path string `json:"path,omitempty"`
}

PanicTraceLine captues a single line in a panic trace that is within the project

type Set

type Set struct {
	Name            string
	TestSummary     Summary             `json:"test_summary"`
	PkgSummary      Summary             `json:"pkg_summary"`
	Cached          int                 `json:"cached"`
	Packages        map[string]*Package `json:"packages"`
	TotalTests      int                 `json:"total_tests"`
	State           Action              `json:"state"`
	BuildErrors     []*BuildError       `json:"build_errors,omitempty"`
	StatementCount  int64               `json:"statements,omitempty"`
	CoveredCount    int64               `json:"covered,omitempty"`
	CoveragePercent float64             `json:"percent,omitempty"`
	FailedTests     []*Test             `json:"failed_tests,omitempty"`
	SkippedTests    []*Test             `json:"skipped_tests,omitempty"`
	SlowTests       []*Test             `json:"slow_tests,omitempty"`
	// contains filtered or unexported fields
}

Set is the complete test results for all packages

func New

func New(path string, threshold time.Duration) *Set

New creates a new setult set

func (*Set) Add

func (set *Set) Add(action Action, pkgName, testName, output string)

Add adds an event line to the setult set

func (*Set) Complete

func (set *Set) Complete(shouldCover bool, coverProfile string)

Complete will mark the set as finished

func (Set) Elapsed

func (watch Set) Elapsed() time.Duration

func (*Set) Parse

func (set *Set) Parse(data []byte)

Parse will parse a reader line by line, adding the lines to the setult set. decor is a callback that can be used for displaying results

func (*Set) ParseError

func (set *Set) ParseError(bdata []byte)

ParseError will try its best to parse an error message for formatting to the output, adding excerpts and diffs where possible

type Summary

type Summary struct {
	Pass int `json:"pass,omitempty"`
	Fail int `json:"fail,omitempty"`
	Skip int `json:"skip,omitempty"`
}

Summary Captuset to status of tests

type Test

type Test struct {
	Name     string     `json:"name"`
	State    Action     `json:"state"`
	Package  string     `json:"package"`
	Failures []*Failure `json:"failures,omitempty"`
	// contains filtered or unexported fields
}

Test is the results for a single test

func (Test) Elapsed

func (watch Test) Elapsed() time.Duration

type TestifyCompStructField

type TestifyCompStructField struct {
	Name     string        `json:"name"`
	Correct  bool          `json:"correct"`
	Val      *TestifyField `json:"val,omitempty"`
	Expected *TestifyField `json:"expected,omitempty"`
	Actual   *TestifyField `json:"actual,omitempty"`
}

TestifyCompStructField captures the state of a testify.compStruct

type TestifyDiff

type TestifyDiff struct {
	Error    string                             `json:"error"`
	Range    string                             `json:"range"`
	Expected string                             `json:"expected"`
	Actual   string                             `json:"actual"`
	Message  string                             `json:"message"`
	Comp     map[string]*TestifyCompStructField `json:"comp"`
}

TestifyDiff captures testifys output after assert.Equal failts

type TestifyField

type TestifyField struct {
	Type   string `json:"type,omitempty"`
	Value  string `json:"value,omitempty"`
	Length string `json:"length,omitempty"`
}

TestifyField is one of the fields in a testify.compStruct expected or actual

Jump to

Keyboard shortcuts

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