FactCheck.jl
FactCheck.jl copied to clipboard
Add `--> true` if not present
I find myself writing things like
@fact a == b
a lot, instead of
@fact a == b --> true
Could we add the --> true automatically if it is not present, to make it more like Base.Test and save effort? Enabling this could be made optional.
I agree with the sentiment, but I can't come up with a good solution where you could still preserve checking that the fact statement is well formed.
How about first trying the fact statement as is; if it would give the current error, then try adding the --> true and see if now it works? (All this is from a position of ignorance about the internal workings.)
but then any statement would "work" at compile time, even if it did not make sense.
Is it possible to call a method towards the end that dispatches on a bool vs anything else:
finalcheck(expr, result::Bool) = result ? SUCCESS() : FAILURE()
finalcheck(expr, result) = NORMAL_HANDLING()
I admit I haven't looked as to whether this is feasible... just an idea.