1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-06-26 05:24:49 +02:00

Add test for RegexSet

This commit is contained in:
Heiko Schaefer 2023-06-28 19:07:38 +02:00 committed by Paul Schaub
parent 34f7f7123f
commit 78aefe154a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -0,0 +1,25 @@
package org.pgpainless.wot.dijkstra.sq
import kotlin.test.Test
class RegexSetTest {
@Test
fun simpleMatch() {
val stringList: List<String> = listOf("<[^>]+[@.]foobank\\.com>$")
val rs = RegexSet.fromExpressionList(stringList);
assert(rs.matches("Foo Bank Employee <employee@foobank.com>"))
assert(rs.matches("<employee@foobank.com>"))
}
@Test
fun simpleNonMatch() {
val stringList: List<String> = listOf("<[^>]+[@.]foobank\\.com>$")
val rs = RegexSet.fromExpressionList(stringList);
assert(!rs.matches("Bar Bank Employee <employee@barbank.com>"))
assert(!rs.matches("<employee@barbank.com>"))
}
}