shouldBeIn

Verify that the value is in the container.

  1. void shouldBeIn(in auto ref T value, in auto ref U container, in string file = __FILE__, in size_t line = __LINE__)
    void
    shouldBeIn
    (
    T
    U
    )
    (
    in auto ref T value
    ,
    in auto ref U container
    ,
    in string file = __FILE__
    ,
    in size_t line = __LINE__
    )
    if (
    isLikeAssociativeArray!(U, T)
    )
  2. void shouldBeIn(in auto ref T value, U container, in string file = __FILE__, in size_t line = __LINE__)

Throws

UnitTestException on failure

Examples

1 5.shouldBeIn([5: "foo"]);
2 
3 struct AA {
4     int onlyKey;
5     bool opBinaryRight(string op)(in int key) const {
6         return key == onlyKey;
7     }
8 }
9 
10 5.shouldBeIn(AA(5));
11 assertFail(5.shouldBeIn(AA(4)));

Meta