[Suggestion] Add a standard `assert` feature of some kind to Seed7. (Ideally, also add unit tests.)
To my shock this afternoon I realized that Seed7 doesn't seem to have any built-in assert macro or function, which is surprising because assertions are such a ubiquitous and helpful tool for sustaining software quality and are so essential a way of thinking for preventing bugs from returning and testing preconditions and postconditions.
I also couldn't find any evidence of a unit test mechanism either, though I am new to Seed7 and so could have missed something (especially if it is named in an uncommon way).
Here is the closest I've been able to come to emulating assert though:
const EXCEPTION: ASSERTION_FAILED is enumlit;
syntax expr: .assert.() is -> 31;
#Priority 31 occurs shortly after some `func` related items in `syntax.s7i`.
#However, in reality I have no idea what I should set the number to.
const proc: assert(in boolean: condition) is func
begin
if not condition then
raise ASSERTION_FAILED;
end if;
end func;
This is ok, though I have to use the second level of the stack trace instead of the first in order to see what line the assertion actually failed at.
Far more important though is the fact that the absence of assert in Seed7 makes me wonder if Seed7 does not have any automated testing. If true, then that is likely to correspond to lots of hidden bugs, though that isn't technically necessarily the case.
Does Seed7 have any automated tests?
Is it regularly tested in any other way?
Built-in assertions and unit testing should really be present in every language in my opinion. It can be worked around, as above, but the absence of these gives me big reasons to be wary. Seed7 still has many things I like though, on the other hand.