doc / ch.tutteli.atrium.api.infix.en_GB / pairs

pairs

fun <K, V> pairs(pair: Pair<K, V>, vararg otherPairs: Pair<K, V>): Pairs<K, V> (source)

Helper function to create a Pairs based on the given pair and otherPairs -- allows expressing Pair<K, V>, vararg Pair<K, V>.

expect(mapOf(1 to "a", 2 to "b")) toContainOnly pairs(1 to "a", 2 to "b")

fails { // because the map contains key 2 with value "b" in addition
    expect(mapOf(1 to "a", 2 to "b")) toContainOnly pairs(1 to "a")
}
fun <K, V> pairs(pair: Pair<K, V>, vararg otherPairs: Pair<K, V>, reportOptionsInOrderOnly: InOrderOnlyReportingOptions.() -> Unit): WithInOrderOnlyReportingOptions<Pairs<K, V>> (source)

Helper function to create a Pairs based on the given pair and otherPairs -- allows expressing Pair<K, V>, vararg Pair<K, V>.

expect(mapOf(1 to "a", 2 to "b")) toContainOnly pairs(1 to "a", 2 to "b")

fails { // because the map contains key 2 with value "b" in addition
    expect(mapOf(1 to "a", 2 to "b")) toContainOnly pairs(1 to "a")
}

Since
0.18.0