Jesse Phillips:

Aren't these things you might do inside a unittest?

Mutating state and calling impure functions is OK in an unittest. So this code is OK:


int foo(ref int y) pure nothrow {
    return y++;
}
unittest {
    int x;
    ++x;
    assert(x);
    foo(x);
    assert(x);
}


Bye,
bearophile

Reply via email to