truth icon indicating copy to clipboard operation
truth copied to clipboard

Provide PrimitiveIntArraySubject.asList().containsExactlyElementsIn(int[]), etc.?

Open cpovirk opened this issue 6 years ago • 1 comments

Seems worth a look, since we have similar methods on PrimitiveDoubleArraySubject and PrimitiveFloatArraySubject? But we'd have to look to establish demand.

And there's also the possibility that we'd make PrimitiveIntArraySubject and friends directly contain methods like containsExactly, in which case we'd want to add the methods there. But maybe that possibility keeps us from wanting to extend asList() further.

(RE: compatibility: We could extend asList() in a binary-compatible way by injecting a bridge method, as we do in places in Guava. This would let us change it to return a more specific type (with the new methods) while remaining compatible with existing callers)

This was prompted by https://github.com/google/truth/issues/570... which points out that our existing methods for double[] and float[] are misnamed :\

cpovirk avatar Jun 10 '19 17:06 cpovirk

Triaging: The IterableSubject returned by asList() doesn't contain an overload for containsExactlyElementsIn(int[]), whereas the float/double versions have specialized methods (as they have their own custom return types that we can hang them off of).

nick-someone avatar Aug 19 '19 16:08 nick-someone