Added lastOrEmpty() extension function.
This commit is contained in:
parent
10f1ee8518
commit
97a9fd1597
3 changed files with 15 additions and 16 deletions
|
@ -46,6 +46,7 @@ import net.thauvin.erik.mobibot.Utils.encodeUrl
|
|||
import net.thauvin.erik.mobibot.Utils.getIntProperty
|
||||
import net.thauvin.erik.mobibot.Utils.green
|
||||
import net.thauvin.erik.mobibot.Utils.helpFormat
|
||||
import net.thauvin.erik.mobibot.Utils.lastOrEmpty
|
||||
import net.thauvin.erik.mobibot.Utils.obfuscate
|
||||
import net.thauvin.erik.mobibot.Utils.plural
|
||||
import net.thauvin.erik.mobibot.Utils.red
|
||||
|
@ -187,6 +188,14 @@ class UtilsTest {
|
|||
assertThat(localDateTime.toIsoLocalDate(), "isoLocalDate(localDate)").isEqualTo("1952-02-17")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLastOrEmpty() {
|
||||
val two = listOf("1", "2")
|
||||
assertThat(two.lastOrEmpty(), "two").isEqualTo("2")
|
||||
val one = listOf("1")
|
||||
assertThat(one.lastOrEmpty(), "one").isEqualTo("")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testObfuscate() {
|
||||
assertThat(ascii.obfuscate(), "obfuscate()").all {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue