toContainRegex

infix fun <T : CharSequence> Expect<T>.toContainRegex(pattern: String): Expect<T>(source)

Expects that the subject of this expectation (a CharSequence) contains a sequence which matches the given regular expression pattern.

It is a shortcut for toContain o atLeast 1 regex pattern.

Return

an Expect for the subject of this expectation.

Since

0.17.0

Parameters

pattern

The pattern which is expected to have a match against the input of the search.

Samples

expect("ABC") toContainRegex "A(B)?"

fails {
    expect("ABC") toContainRegex "X"
}