only

The phrase .contain.only or .only.contain takes a range, the elements of which are expected to be the only elements appearing in the range on the left hand side.

void
only
(
Should
T
)
(
Should should
,,
Fence _ = Fence()
,
string file = __FILE__
,
size_t line = __LINE__
)
if (
isInstanceOf!(ShouldType, Should)
)

Examples

[3, 4].should.only.contain([4, 3]);
[3, 4].should.only.contain([1, 2, 3, 4]);
[3, 4].should.contain.only([4, 3]);
[2, 3, 4].should.not.only.contain([4, 3]);

Meta