linttest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Suite

type Suite struct {
	Palette string
	Files   []linttest.TestFile
	Expect  []string
	// contains filtered or unexported fields
}

Suite is a configurable test runner for linter.

Use NewSuite to create usable instance.

func NewSuite

func NewSuite(t testing.TB) *Suite

NewSuite returns a new linter test suite for t.

func (*Suite) AddFile

func (s *Suite) AddFile(contents string)

AddFile adds a file to a suite file list. File gets an auto-generated name. If custom name is important, use AddNamedFile.

func (*Suite) AddNamedFile

func (s *Suite) AddNamedFile(name, contents string)

AddNamedFile adds a file with a specific name to a suite file list.

func (*Suite) Match

func (s *Suite) Match(reports []*pipes.ColorReport)

Match tries to match every report against Expect list of s.

If expect slice is nil or empty, only nil (or empty) reports slice would match it.

func (*Suite) RunAndMatch

func (s *Suite) RunAndMatch()

RunAndMatch calls Match with the results of RunLinter.

This is a recommended way to use the Suite, but if reports slice is needed, one can use RunLinter directly.

func (*Suite) RunLinter

func (s *Suite) RunLinter() []*pipes.ColorReport

RunLinter executes linter over s Files and returns all issue reports that were produced during that.

Jump to

Keyboard shortcuts

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