FactCheck.jl icon indicating copy to clipboard operation
FactCheck.jl copied to clipboard

Add `--> true` if not present

Open dpsanders opened this issue 10 years ago • 4 comments

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.

dpsanders avatar Aug 19 '15 04:08 dpsanders

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.

jakebolewski avatar Aug 19 '15 05:08 jakebolewski

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.)

dpsanders avatar Aug 19 '15 05:08 dpsanders

but then any statement would "work" at compile time, even if it did not make sense.

jakebolewski avatar Aug 19 '15 05:08 jakebolewski

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.

tbreloff avatar Aug 31 '15 18:08 tbreloff