Documentation ¶
Index ¶
- func AnyPattern(pattern string) func(matcher *base.Matcher) *base.Matcher
- func AnyPatternGroup(pattern string, group int) func(matcher *base.Matcher) *base.Matcher
- func Contains(substring string) *base.Matcher
- func EachPattern(pattern string) func(matcher *base.Matcher) *base.Matcher
- func EachPatternGroup(pattern string, group int) func(matcher *base.Matcher) *base.Matcher
- func EqualToIgnoringCase(expected string) *base.Matcher
- func HasPattern(pattern string) *base.Matcher
- func HasPrefix(prefix string) *base.Matcher
- func HasSuffix(suffix string) *base.Matcher
- func OnPattern(pattern string) func(matcher *base.Matcher) *base.Matcher
- func OnPatternGroup(pattern string, group int) func(matcher *base.Matcher) *base.Matcher
- func ToGoString(matcher *base.Matcher) *base.Matcher
- func ToLen(matcher *base.Matcher) *base.Matcher
- func ToLower(matcher *base.Matcher) *base.Matcher
- func ToString(matcher *base.Matcher) *base.Matcher
- func ToUpper(matcher *base.Matcher) *base.Matcher
- type WithPatternClause
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyPattern ¶
Returns a short-circuiting function that applies the matcher to each occurrence of the pattern in an input string, until a matching pattern is found (in which case the matcher successfully matches) or all matching instances are exhausted (in which case the output matcher fails to match).
For example:
AnyPattern("x.")(EqualTo("xy"))
would match:
"six sax are sexy" (three matches of "x.", third is "xy")
but not:
"pox pix are pixelated" (three matches of "x.", none is "xy")
func AnyPatternGroup ¶
Variant of AnyPattern() that uses the given subgroup of the pattern.
func EachPattern ¶
Returns a short-circuiting function that applies the matcher to each occurrence of the pattern in an input string, until a failing pattern is found (in which case the output matcher fails to match) or all matching instances are exhausted (in which case the output matcher successfully matches).
For example:
EachPattern("q.")(EqualTo("qu"))
would match:
"quick quack mq" (two matches of "q.", both equal to "qu")
but not:
"quick qs for mq" (two matches of "q.", second is not "qu")
func EachPatternGroup ¶
Variant of EachPattern() that uses the given subgroup of the pattern.
func EqualToIgnoringCase ¶
func HasPattern ¶
Matches strings that contain the given regexp pattern, using the same syntax as the standard regexp package.
func OnPattern ¶
Returns a function that applies the matcher to the first occurrence of the pattern in an input string.
For example:
OnPattern("h.s")(EqualTo("his"))
would match:
"hers and his" (because the first instance of "h.s" is equal to "his")
but none of:
"just hers" (no instances of "h.s") "has chisel" (the first instance of "h.s" is not "his")
func OnPatternGroup ¶
Variant of OnPattern() that uses the given subgroup of the pattern.
func ToGoString ¶
Applies the given matcher to the result of writing the input object's to a string by using fmt.Sprintf("%#v", object).
func ToLen ¶
Creates a new matcher that applies the given matcher to the result of converting an input string its length. (using the `len()` builtin). If the input value is not a string, the matcher fails to match.
func ToLower ¶
Creates a new matcher that applies the given matcher to the result of converting an input string to lowercase (using strings.ToLower). If the input value is not a string, the matcher fails to match.
Types ¶
type WithPatternClause ¶
type WithPatternClause struct {
// contains filtered or unexported fields
}