notToMatch

infix fun <T : CharSequence> Expect<T>.notToMatch(pattern: Regex): Expect<T>(source)

Expects that the subject of this expectation (a CharSequence) mismatches the given Regex.

In contrast to notToContain o regex expected it does not look for a partial match but for an entire match.

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

expect("ABC") notToMatch "A".toRegex() // subject isn't fully matched

fails { // because subject is fully matched, use notToContain.regex for partial matching
    expect("ABC")  notToMatch "A(B)?C".toRegex()
}