assertEmpty

Assert range isn't empty.

  1. alias assertEmpty = assertProp!("empty", true)
    alias assertEmpty = assertProp!("empty", true)
  2. alias assertNotEmpty = assertProp!("empty", false)

Examples

// Issue 9588 - format prints context pointer for struct
static struct S { int x; bool empty() { return x == 0; } }

S s = S(1);
assert(assertEmpty(s).getExceptionMsg == ".empty is false : S(1)");

s.x = 0;
assertEmpty(s);

assert(assertNotEmpty(s).getExceptionMsg == ".empty is true : S(0)");
s.x = 1;
assertNotEmpty(s);

Meta