diff --git a/docs/labs/create_checker.md b/docs/labs/create_checker.md index 7a490772..6d30b14c 100644 --- a/docs/labs/create_checker.md +++ b/docs/labs/create_checker.md @@ -442,8 +442,8 @@ hints: [ absent: ", $", text: "This is a parameter, it must end with a comma.", examples: [ - [ " " ] - ] + [ " " ], + ], }, { present: "(isint|Isint|IsInt|ISINT)", @@ -451,9 +451,9 @@ hints: [ examples: [ [ " query('id').isint()," ], [ " query('id').IsInt()," ], - ] - } -] + ], + }, +], ~~~~ The first hint triggers when the user attempt does *not* contain the @@ -475,12 +475,17 @@ make smaller changes, test them, and once they work check them in. That way you won't need to debug a long complicated set of changes. -Please create tests! You can create test cases for attempts -(`successes` should pass, `failures` should fail), and test cases -to ensure the hints work correctly. +Please create tests! You should create test cases for full attempts +(`successes` should pass, `failures` should fail) and test cases +for hints (`examples`). Remember, hints are checked in order - it's possible to create a hint that won't trigger because something earlier would always match. -These tests are automatically checked every time the page is (re)loaded. +All tests are automatically re-run every time the page is (re)loaded. + +In a hint, `examples` is an array of examples that should trigger the hint. +Each example is an array of answers. If you use an index, the other index +values aren't considered. We suggest using `null` for array entries +that aren't relevant for the test. ### Debugging diff --git a/docs/labs/mass-test b/docs/labs/mass-test index 39937a55..3a8e21a2 100755 --- a/docs/labs/mass-test +++ b/docs/labs/mass-test @@ -2,9 +2,11 @@ # Mass open all lab files. Do this by opening every lab in a web browser, # which will invoke each lab's built-in tests. +# Each file should have a yellow input field (so the JavaScript ran) +# and *not* show a test failure (so all embedded tests passed). # Create a list of labs -grep -o '[A-Za-z0-9_-]*\.html' README.md | sort |uniq > ,1 +grep -l 'src=.*checker.js' [a-z]*.html > ,1 OPENER=xdg-open if ! which "$OPENER" >/dev/null; then