grep

package
v0.127.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package grep implements functions to parse and filter spec files by cypress-grep expressions.

See https://www.npmjs.com/package/@cypress/grep for details on the specific syntax of cypress-grep expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchFiles

func MatchFiles(sys fs.FS, files []string, title string, tag string) (matched []string, unmatched []string)

MatchFiles finds the files whose contents match the grep expression in the title parameter and the grep tag expression in the tag parameter.

Types

type All

type All struct {
	Expressions []Expression
}

All represents a composite expression that evaluates to true if all child expressions evaluate to true.

func (*All) Eval

func (a *All) Eval(input string) bool

type Any

type Any struct {
	Expressions []Expression
}

Any represents a composite expression that evaluates to true if any child expression evaluates to true.

func (*Any) Eval

func (a *Any) Eval(input string) bool

type Exact

type Exact struct {
	Query  string
	Invert bool
}

Exact represents an expression that wraps a string to be matched and evalutates to true if that string is an exact substring of the input.

func (Exact) Eval

func (e Exact) Eval(input string) bool

type Expression

type Expression interface {
	// Eval evaluates the Expression against the input string.
	Eval(input string) bool
}

Expression is an interface that represents a logical statement.

func ParseGrepTagsExp

func ParseGrepTagsExp(expr string) Expression

ParseGrepTagsExp parses a cypress-grep tag expression.

The returned Expression can be used to evaluate whether a given string can match the expression.

func ParseGrepTitleExp

func ParseGrepTitleExp(expr string) Expression

ParseGrepTitleExp parses a cypress-grep expression and returns an Expression.

The returned Expression can be used to evaluate whether a given string can match the expression.

type Literal

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

Literal represents an expression that always evaluates to a literal truth value.

func (Literal) Eval

func (l Literal) Eval(input string) bool

type Partial

type Partial struct {
	Query  string
	Invert bool
}

Partial represents an expression that wraps a string to be matched and evaluates to true if that string is a partial substring of the input.

func (Partial) Eval

func (p Partial) Eval(input string) bool

Jump to

Keyboard shortcuts

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