-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve failure message #202
Conversation
For demo purpose, I have pushed this branch with a failing test. You can then see (with colours):
|
94fefd5
to
f490ab5
Compare
bde16ab
to
ca6aea2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, congratulations!
I confess that I didn’t carefully review the generated code 😅 but this looks all good to me.
Three small questions/remarks:
- I assume you went with
(++)
to get it infix in the generated code? I think I would prefer the fully-qualified call, just like what is done for all the Gospel operators. And I would suggest picking a different one, to avoid the confusion withGospelstdlib.(++)
. - This is really quibbling: I noticed various uses of
@\n
, which is better avoided according toFormat
’s documentation. Did you try alternatives (thinking it might make the generated output a bit more robust)?
src/core/utils.mli
Outdated
@@ -1,3 +1,9 @@ | |||
val term_printer : string -> Ppxlib.Location.t -> Gospel.Tterm.term -> string | |||
(** [term_printer text global_loc term] fetch the initial text representation of | |||
[term] providede that [text] is the specification's text and [global_loc] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: “providede“
ca6aea2
to
6ab1789
Compare
Thanks!
Yes, I went for the infix operator to avoid things like
This is the end-of-line that is mostly used in the project I think. Maybe we can change it with consistency in the whole repo if we find a better candidate. |
6ab1789
to
265f0e2
Compare
18cff6b
to
ec853a5
Compare
This will be needed in the following development
Add the textual representation of the Gospel term for future display in case of test failure.
The runtime reimplement the QCheckSTM.Sequential.Make functor to use new postcond function. It also implement how the failure message is printed and the append function for postcond.
The Spec module contains a dummy postcond function, always returning true. The new postcond function return an `Ortac_runtime.report option`. Checking one term return a value of such a type, with a singleton for the list. Results of checking several terms will be combine using an append function defined in the runtime.
ec853a5
to
1cfa3e1
Compare
CI is green, merging. |
This PR improve the state of #188
This PR is based on #197, please consider only the last 7 commits.
Basically, this PR makes
postcond
return the reason of the failure rather than just a boolean, so that we can print the Gospel terms being violated back to the user in case of failing test.This lead to give another implementation of the
STM_Sequential.Make
functor in a newOrtac_runtime_qcheck_stm
package to use this newpostcond
function and build and pass toQCheck
the new failure message.