-
Notifications
You must be signed in to change notification settings - Fork 26
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
Assert statements in GOOL #3911
Comments
@Xinlu-Y good work! One place where With I'm not sure if GOOL currently has equality checking with lists, so we might need to figure that out first. I don't think that should be too hard to add if necessary, though. |
I made a comment about this a bit ago in #3557. Python has the
assert
keyword that checks a condition and throws an error if it is not met. If we could add this idea to GOOL, we could use it to improve our testing methods.In particular, we could use it in drasil-code/test to improve our GOOL tests in stable/gooltest. Currently a lot of those tests just run, without checking any values; and at most they print out values without telling us what the values should be. Using
assert
statements would really help with that.Here's an outline of what we need to do:
assert :: SValue r -> MSStatement r
to InterfaceCommon.hs. Most likely theControlStatement
typeclass would be where we want to add it.assert
in different languages. In Python this would be the most straightforward -assert(cond)
; in other languages we might just have to doif (!cond) {throw error}
or something like that. It would depend on whether the language has something likeassert
built-in or not.assert
in each of the renderers.Once we have that in place, we can start using it in
drasil-code/test
to improve our testing.@Xinlu-Y you said you were interested in working with GOOL. This could be a good medium-sized project that should be fairly beginner-friendly.
The text was updated successfully, but these errors were encountered: