mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-24 11:57:59 +01:00
100% coverage of RegexSet class
This commit is contained in:
parent
31a7a822ac
commit
8aa3df5878
1 changed files with 20 additions and 0 deletions
|
@ -2,6 +2,7 @@ package org.pgpainless.wot.network
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.pgpainless.wot.dsl.NetworkDSL
|
import org.pgpainless.wot.dsl.NetworkDSL
|
||||||
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertFalse
|
import kotlin.test.assertFalse
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
@ -64,4 +65,23 @@ class RegexSetTest: NetworkDSL {
|
||||||
assertTrue { regex.matches("Alice <alice@pgpainless.org>") }
|
assertTrue { regex.matches("Alice <alice@pgpainless.org>") }
|
||||||
assertFalse { regex.matches("<alice@pgpainless\\.org>") }
|
assertFalse { regex.matches("<alice@pgpainless\\.org>") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `verify that wildcard()_toString() equals empty string`() {
|
||||||
|
val regex = RegexSet.wildcard()
|
||||||
|
assertEquals("", regex.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `verify that single regex _toString() returns the regex`() {
|
||||||
|
val regex = domainRegex("pgpainless.org")
|
||||||
|
assertEquals("<[^>]+[@.]pgpainless\\.org>\$", regex.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `verify that multiple regex _toString returns comma separated values`() {
|
||||||
|
val list = listOf("<[^>]+[@.]pgpainless\\.org>\$", "<[^>]+[@.]example\\.com>\$")
|
||||||
|
val regex = RegexSet.fromExpressionList(list)
|
||||||
|
assertEquals("<[^>]+[@.]pgpainless\\.org>\$, <[^>]+[@.]example\\.com>\$", regex.toString())
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue