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

commonMain.io.kotest.inspectors.deprecated.kt Maven / Gradle / Ivy

package io.kotest.inspectors

@Deprecated("use the extension function version of this", ReplaceWith("array.forAll(fn)"))
fun  forAll(array: Array, fn: (T) -> Unit) = forAll(array.asList(), fn)

@Deprecated("use the extension function version of this", ReplaceWith("col.forAll(fn)"))
fun  forAll(col: Collection, fn: (T) -> Unit) {
  val results = runTests(col, fn)
  val passed = results.filterIsInstance>()
  if (passed.size < col.size) {
    val msg = "${passed.size} elements passed but expected ${col.size}"
    buildAssertionError(msg, results)
  }
}

@Deprecated("use the extension function version of this", ReplaceWith("array.forOne(fn)"))
fun  forOne(array: Array, fn: (T) -> Unit) = forOne(array.asList(), fn)

@Deprecated("use the extension function version of this", ReplaceWith("col.forOne(fn)"))
fun  forOne(col: Collection, f: (T) -> Unit) = forExactly(1, col, f)

@Deprecated("use the extension function version of this", ReplaceWith("array.forExactly(fn)"))
fun  forExactly(k: Int, array: Array, f: (T) -> Unit) = forExactly(k, array.asList(), f)

@Deprecated("use the extension function version of this", ReplaceWith("col.forExactly(fn)"))
fun  forExactly(k: Int, col: Collection, fn: (T) -> Unit) {
  val results = runTests(col, fn)
  val passed = results.filterIsInstance>()
  if (passed.size != k) {
    val msg = "${passed.size} elements passed but expected $k"
    buildAssertionError(msg, results)
  }
}

@Deprecated("use the extension function version of this", ReplaceWith("array.forSome(fn)"))
fun  forSome(array: Array, f: (T) -> Unit) = forSome(array.asList(), f)

@Deprecated("use the extension function version of this", ReplaceWith("col.forSome(fn)"))
fun  forSome(col: Collection, fn: (T) -> Unit) {
  val size = col.size
  val results = runTests(col, fn)
  val passed = results.filterIsInstance>()
  if (passed.isEmpty()) {
    buildAssertionError("No elements passed but expected at least one", results)
  } else if (passed.size == size) {
    buildAssertionError("All elements passed but expected < $size", results)
  }
}

@Deprecated("use the extension function version of this", ReplaceWith("array.forAny(fn)"))
fun  forAny(array: Array, f: (T) -> Unit) = forAny(array.asList(), f)

@Deprecated("use the extension function version of this", ReplaceWith("col.forAny(fn)"))
fun  forAny(col: Collection, f: (T) -> Unit) = forAtLeast(1, col, f)

@Deprecated("use the extension function version of this", ReplaceWith("array.forAtLeastOne(fn)"))
fun  forAtLeastOne(array: Array, f: (T) -> Unit) = forAtLeastOne(array.asList(), f)

@Deprecated("use the extension function version of this", ReplaceWith("col.forAtLeastOne(fn)"))
fun  forAtLeastOne(col: Collection, f: (T) -> Unit) = forAtLeast(1, col, f)

@Deprecated("use the extension function version of this", ReplaceWith("array.forAtLeast(fn)"))
fun  forAtLeast(k: Int, array: Array, f: (T) -> Unit) = forAtLeast(k, array.asList(), f)

@Deprecated("use the extension function version of this", ReplaceWith("col.forAtLeast(fn)"))
fun  forAtLeast(k: Int, col: Collection, f: (T) -> Unit) {
  val results = runTests(col, f)
  val passed = results.filterIsInstance>()
  if (passed.size < k) {
    val msg = "${passed.size} elements passed but expected at least $k"
    buildAssertionError(msg, results)
  }
}

@Deprecated("use the extension function version of this", ReplaceWith("array.forAtMostOne(fn)"))
fun  forAtMostOne(array: Array, f: (T) -> Unit) = forAtMost(1, array.asList(), f)

@Deprecated("use the extension function version of this", ReplaceWith("col.forAtMostOne(fn)"))
fun  forAtMostOne(col: Collection, f: (T) -> Unit) = forAtMost(1, col, f)

@Deprecated("use the extension function version of this", ReplaceWith("col.forAtMost(fn)"))
fun  forAtMost(k: Int, col: Collection, f: (T) -> Unit) {
  val results = runTests(col, f)
  val passed = results.filterIsInstance>()
  if (passed.size > k) {
    val msg = "${passed.size} elements passed but expected at most $k"
    buildAssertionError(msg, results)
  }
}

@Deprecated("use the extension function version of this", ReplaceWith("array.forNone(fn)"))
fun  forNone(array: Array, testFn: (T) -> Unit) = forNone(array.asList(), testFn)

@Deprecated("use the extension function version of this", ReplaceWith("col.forNone(fn)"))
fun  forNone(col: Collection, testFn: (T) -> Unit) = forExactly(0, col, testFn)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy