-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Bug description
Let's consider a exercise about a function foo with at least one int argument.
If the tests about this function (e.g. Test_lib.test_function_1) may involve negative integers,
then the grader report will display these negative numbers without parenthesis. This leads to
incorrect code fragment like foo -6 in the report :
Computing foo -6 : 1 pt
Correct value 6
This isn't just a cosmetic error, it actually prevent a student from copy-pasting these
fragments unedited in an OCaml toplevel for debugging purpose (the actual situation
was involving a function with many arguments).
To Reproduce
Create an exercise about a function foo : int -> int and test it for instance with Test_lib.test_function_1 with at least one negative test case.
Expected behavior
An output such as : Computing foo (-6) ... (with parenthesis around the negative numbers)
Additional context
I've looked a bit at learnocaml source code, it looks like this issue is due to Introspection.print_value being too optimistic in its need_parentheses sub-routine. I'd be tempted to add - to the characters triggering the case `Decided true (around line 186 in introspection.ml).