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.

  1. void only(Should should, T expected, Fence _, string file, size_t line)
    void
    only
    (
    Should
    T
    )
    (
    Should should
    ,,
    Fence _ = Fence()
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    isInstanceOf!(ShouldType, Should)
    )
  2. auto only(Should 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