NonEmpty

When a field is marked with @NonEmpty, !field.empty is asserted.

struct NonEmpty

Examples

class Class
{
    @NonEmpty
    int[] array_;

    this(int[] array)
    {
        this.array_ = array;
    }

    mixin(GenerateInvariants);
}

(new Class(null)).shouldThrow!AssertError;
1 class Class
2 {
3     @NonEmpty
4     private int[] array_;
5 
6     this(int[] array)
7     {
8         this.array_ = array;
9     }
10 
11     public void array(int[] arrayValue)
12     {
13         this.array_ = arrayValue;
14     }
15 
16     mixin(GenerateInvariants);
17 }
18 
19 (new Class([2])).array(null).shouldThrow!AssertError;

Meta