assertNotEmpty

Assert range isn't empty.

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

Examples

1 // Issue 9588 - format prints context pointer for struct
2 static struct S { int x; bool empty() { return x == 0; } }
3 
4 S s = S(1);
5 assert(assertEmpty(s).getExceptionMsg == ".empty is false : S(1)");
6 
7 s.x = 0;
8 assertEmpty(s);
9 
10 assert(assertNotEmpty(s).getExceptionMsg == ".empty is true : S(0)");
11 s.x = 1;
12 assertNotEmpty(s);

Meta