Skip to content

Commit

Permalink
fix(grader): Display negative numbers with mandatory parens; Fix #440
Browse files Browse the repository at this point in the history
* Thanks @letouzey for reporting this issue and suggesting a fix

* Update some learn-ocaml-client tests accordingly
  • Loading branch information
erikmd committed Oct 15, 2021
1 parent 07033c9 commit 35941b5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/grader/introspection.ml
Expand Up @@ -183,7 +183,7 @@ let print_value ppf v ty =
state := `Undecided ;
for i = ofs to ofs + len - 1 do
match String.get s i with
| ' ' | '\n' | '\r' | '\t' ->
| '-' | ' ' | '\n' | '\r' | '\t' ->
state := `Decided true ;
raise Exit
| _ -> ()
Expand Down
4 changes: 2 additions & 2 deletions tests/test1/demo/bad_plus.ml.json
Expand Up @@ -79,7 +79,7 @@
"text": "Computing"
},
{
"text": "plus 10 -10",
"text": "plus 10 (-10)",
"display": "code"
}
],
Expand All @@ -91,7 +91,7 @@
"text": "Wrong value"
},
{
"text": "-100",
"text": "(-100)",
"display": "code"
}
],
Expand Down
2 changes: 1 addition & 1 deletion tests/test1/demo/demo.ml.json
Expand Up @@ -79,7 +79,7 @@
"text": "Computing"
},
{
"text": "plus 10 -10",
"text": "plus 10 (-10)",
"display": "code"
}
],
Expand Down
6 changes: 3 additions & 3 deletions tests/test1/demo/demo2.ml.json
Expand Up @@ -79,7 +79,7 @@
"text": "Computing"
},
{
"text": "plus 10 -10",
"text": "plus 10 (-10)",
"display": "code"
}
],
Expand Down Expand Up @@ -155,7 +155,7 @@
"text": "Computing"
},
{
"text": "minus 4 -2",
"text": "minus 4 (-2)",
"display": "code"
}
],
Expand Down Expand Up @@ -191,7 +191,7 @@
"text": "Correct value"
},
{
"text": "-10",
"text": "(-10)",
"display": "code"
}
],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_negative_int/int_exo/correct.ml.json
Expand Up @@ -75,4 +75,4 @@
}
]
}
]
]

0 comments on commit 35941b5

Please sign in to comment.