the specification is provided in a custom DSL that requires us to write pre and post blocks. There is a possible way to write more natural specifications that looks exactly like tests, without separate pre and post blocks.
wrapped_func1:
call synthesized func
raise an exception wrapping the return value
wrapped_func2:
call wrapped_func1
if need to run user provided post condition:
catch the exception and return unwrapped return value
else:
forward the exception
eval_ast:
set the flag to indicate if running user provided postcond or not
define wrapped_func2 instead of synthesized func in the eval context
eval the spec
if exception:
call the engine provided post cond
else:
we have run the user post cond
This is a tricky change to make, but will make the user specs look much nicer.
the specification is provided in a custom DSL that requires us to write
pre
andpost
blocks. There is a possible way to write more natural specifications that looks exactly like tests, without separate pre and post blocks.This is a tricky change to make, but will make the user specs look much nicer.