but
infix fun <E, T : IterableLike> IterableLikeContains.EntryPointStep<E, T, InAnyOrderSearchBehaviour>.but(only: only): IterableLikeContains.EntryPointStep<E, T, InAnyOrderOnlySearchBehaviour>(source)
Defines that the constraint "only the specified entries exist in the IterableLike" shall be applied to this sophisticated to contain in IterableLike expectation.
Return
The newly created builder.
Since
0.14.0 -- API existed for Iterable but not for IterableLike.
infix fun <K, V, T : MapLike> MapLikeContains.EntryPointStep<K, V, T, InAnyOrderSearchBehaviour>.but(only: only): MapLikeContains.EntryPointStep<K, V, T, InAnyOrderOnlySearchBehaviour>(source)
Defines that the constraint "only the specified entries exist in the MapLike" shall be applied to this sophisticated contains MapLike assertion.
Return
The newly created builder.
Since
0.15.0
Samples
expect(mapOf(1 to "a")) toContain o inAny order but only entry (1 to "a")
fails { // because subject has additional entries
expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order but only entry (2 to "c")
}