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;
class Class
{
    @NonEmpty
    private int[] array_;

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

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

    mixin(GenerateInvariants);
}

(new Class([2])).array(null).shouldThrow!AssertError;

Meta