All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.kotest.matchers.string.end.kt Maven / Gradle / Ivy

package io.kotest.matchers.string

import io.kotest.assertions.show.show
import io.kotest.matchers.Matcher
import io.kotest.matchers.MatcherResult
import io.kotest.matchers.neverNullMatcher
import io.kotest.matchers.should
import io.kotest.matchers.shouldNot

infix fun  A?.shouldEndWith(suffix: CharSequence): A {
   this should endWith(suffix)
   return this!!
}

infix fun  A?.shouldNotEndWith(suffix: CharSequence): A {
   this shouldNot endWith(suffix)
   return this!!
}

fun endWith(suffix: CharSequence): Matcher = neverNullMatcher { value ->
   MatcherResult(
      value.endsWith(suffix),
      { "${value.show().value} should end with ${suffix.show().value}" },
      {
         "${value.show().value} should not end with ${suffix.show().value}"
      })
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy