[Issue 2618] Assert errors should be unrecoverable.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 26 00:58:34 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2618





------- Comment #1 from braddr at puremagic.com  2009-01-26 02:58 -------
Counter point.. how would one unit test proper assertions should they become
non-catchable?  For example:

void foo(int i) {
    assert(i != 3, "don't ask me why, but 3 is illegal");
}

unittest {
    try {
        foo(3);
        assert(false, "should not have reached here");
    } catch (AssertError e) {
        assert(e.msg() == "don't ask me why, but 3 is illegal");
    }
}

(typed on the fly, so forgive any minor errors and worry about the desired
behavior)


-- 



More information about the Digitalmars-d-bugs mailing list