testexpectations

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LayoutTestExpectations is a map of expectation file locations, relative to repo+branch.
	LayoutTestExpectations = map[string]string{
		"TestExpectations":      "third_party/blink/web_tests/TestExpectations",
		"ASANExpectations":      "third_party/blink/web_tests/ASANExpectations",
		"LeakExpectations":      "third_party/blink/web_tests/LeakExpectations",
		"MSANExpectations":      "third_party/blink/web_tests/MSANExpectations",
		"NeverFixTests":         "third_party/blink/web_tests/NeverFixTests",
		"SlowTests":             "third_party/blink/web_tests/SlowTests",
		"SmokeTests":            "third_party/blink/web_tests/SmokeTests",
		"StaleTestExpectations": "third_party/blink/web_tests/StaleTestExpectations",
		"W3CImportExpectations": "third_party/blink/web_tests/W3CImportExpectations",
	}
)

Functions

func LoadBuilderConfigs

func LoadBuilderConfigs(c context.Context) (map[string]*BuilderConfig, error)

LoadBuilderConfigs loads bulders.json from gitiles.

Types

type BuilderConfig

type BuilderConfig struct {
	// PortName is the name of the OS port.
	PortName string `json:"port_name"`
	// Specifiers modify the conditions of the expectations.
	Specifiers []string `json:"specifiers"`
	// IsTryBuilder is true if the builder is a trybot.
	IsTryBuilder bool `json:"is_try_builder"`
}

BuilderConfig represents the expectation settings for a builder.

type ExpectationStatement

type ExpectationStatement struct {
	// LineNumber from the original input file.
	LineNumber int
	// Comment, if any.
	Comment string
	// Bugs associated with the test expectation.
	Bugs []string
	// Modifiers (optional) for the test expectation/
	Modifiers []string
	// TestName identifies the test file or test directory.
	TestName string
	// Expectations is a list of expected test results.
	Expectations []string
	// Original line content.
	Original string
	// Dirty indicates that fields have changed since Original was parsed.
	Dirty bool
}

ExpectationStatement represents a statement (one line) from a layout test expectation file.

func (*ExpectationStatement) Applies

func (es *ExpectationStatement) Applies(testName, configuration string) bool

Applies returns true if the statement applies to the given test, configuration.

func (*ExpectationStatement) ExpandModifiers

func (es *ExpectationStatement) ExpandModifiers() []string

ExpandModifiers returns the list of all modifiers that the rule should match.

func (*ExpectationStatement) IsDir

func (es *ExpectationStatement) IsDir() bool

IsDir returns true if the statement's test name is actually a file path to a directory rather than an individual test.

func (*ExpectationStatement) ModifierMatch

func (es *ExpectationStatement) ModifierMatch(mod string) bool

ModifierMatch returns true if the given modifier matches the statement's modifier or any of its expanded modifiers.

func (*ExpectationStatement) NameMatch

func (es *ExpectationStatement) NameMatch(testName string) bool

NameMatch returns true if the extatement matches testName.

func (*ExpectationStatement) Overrides

func (es *ExpectationStatement) Overrides(other *ExpectationStatement) bool

Overrides returns true if the receiver should override other when evaluating statement matches for a given test, configuration. This establishes an ordering on the expectation statements so they can be sorted by precedence.

func (*ExpectationStatement) String

func (e *ExpectationStatement) String() string

type File

type File struct {
	Path         string
	Expectations []*ExpectationStatement
}

File is an expectation file.

func (*File) String

func (f *File) String() string

type FileSet

type FileSet struct {
	Files []*File
}

FileSet is a set of expectation files.

func LoadAll

func LoadAll(c context.Context) (*FileSet, error)

LoadAll returns a FileSet of all known layout test expectation files.

func (*FileSet) ForTest

func (fs *FileSet) ForTest(testName string, config *BuilderConfig) []*ExpectationStatement

ForTest returns a list of ExpectationStatement, sorted in decreasing order of precedence, that match the given test and configuration.

func (*FileSet) ToCL

func (fs *FileSet) ToCL() map[string]string

ToCL returns a map of file paths to new file contents.

func (*FileSet) UpdateExpectation

func (fs *FileSet) UpdateExpectation(es *ExpectationStatement) error

UpdateExpectation updates a test expectation within a FileSet.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser parses layout test expectation files.

func NewParser

func NewParser(r io.Reader) *Parser

NewParser returns a new instance of Parser for io.Reader input.

func NewStringParser

func NewStringParser(str string) *Parser

NewStringParser returns a new instance of Parser for string input.

func (*Parser) Parse

func (p *Parser) Parse() (*ExpectationStatement, error)

Parse parses a *line* of input to produce an ExpectationStatement, or error.

Jump to

Keyboard shortcuts

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