org.amshove.kluent.CharSequenceBacktick.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kluent Show documentation
Show all versions of kluent Show documentation
Fluent Assertion-Library for Kotlin
package org.amshove.kluent
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
infix fun T.`should start with`(expected: CharSequence) = this.shouldStartWith(expected)
infix fun T.`should end with`(expected: CharSequence) = this.shouldEndWith(expected)
infix fun T.`should contain`(char: Char) = this.shouldContain(char)
infix fun T.`should contain some`(things: Iterable) = this.shouldContainSome(things)
infix fun T.`should contain none`(things: Iterable) = this.shouldContainNone(things)
infix fun T.`should contain`(expected: CharSequence) = this.shouldContain(expected)
infix fun T.`should not contain`(char: Char) = this.shouldNotContain(char)
infix fun T.`should not contain any`(things: Iterable) = this.shouldNotContainAny(things)
infix fun T.`should match`(regex: String) = this.shouldMatch(regex)
infix fun T.`should match`(regex: Regex) = this.shouldMatch(regex)
fun T.`should be empty`() = this.shouldBeEmpty()
fun T?.`should be null or empty`() = this.shouldBeNullOrEmpty()
fun T.`should be blank`() = this.shouldBeBlank()
fun T?.`should be null or blank`() = this.shouldBeNullOrBlank()
@Deprecated("Use #`should be equal to`", ReplaceWith("this.`should be equal to`(expected)"))
infix fun String.`should equal to`(expected: String) = this.`should be equal to`(expected)
infix fun String.`should be equal to`(expected: String) = this.shouldBeEqualTo(expected)
@Deprecated("Use #`should not be equal to`", ReplaceWith("this.`should not be equal to`(expected)"))
infix fun String.`should not equal to`(expected: String) = this.`should not be equal to`(expected)
infix fun String.`should not be equal to`(expected: String) = this.shouldNotBeEqualTo(expected)
infix fun T.`should not start with`(expected: CharSequence) = this.shouldNotStartWith(expected)
infix fun T.`should not end with`(expected: CharSequence) = this.shouldNotEndWith(expected)
infix fun T.`should not contain`(expected: CharSequence) = this.shouldNotContain(expected)
infix fun T.`should not match`(regex: String) = this.shouldNotMatch(regex)
infix fun T.`should not match`(regex: Regex) = this.shouldNotMatch(regex)
fun T.`should not be empty`(): T = this.shouldNotBeEmpty()
@UseExperimental(ExperimentalContracts::class)
fun T?.`should not be null or empty`(): T {
contract {
returns() implies (this@`should not be null or empty` != null)
}
return this.shouldNotBeNullOrEmpty()
}
fun T.`should not be blank`(): T = this.shouldNotBeBlank()
@UseExperimental(ExperimentalContracts::class)
fun T?.`should not be null or blank`(): T {
contract {
returns() implies (this@`should not be null or blank` != null)
}
return this.shouldNotBeNullOrBlank()
}
infix fun T.`should contain all`(items: Iterable): CharSequence = this.shouldContainAll(items)
infix fun T.`should not contain all`(items: Iterable): CharSequence =
this.shouldNotContainAll(items)