1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-25 04:17:59 +01:00

Add test for RegexSet

This commit is contained in:
Heiko Schaefer 2023-06-28 19:07:38 +02:00
parent 7a777ab914
commit ac5919bcf7
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D

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>"))
}
}