Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions docs/labs/create_checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,18 +442,18 @@ hints: [
absent: ", $",
text: "This is a parameter, it must end with a comma.",
examples: [
[ " " ]
]
[ " " ],
],
},
{
present: "(isint|Isint|IsInt|ISINT)",
text: "JavaScript is case-sensitive. Use isInt instead.",
examples: [
[ " query('id').isint()," ],
[ " query('id').IsInt()," ],
]
}
]
],
},
],
~~~~

The first hint triggers when the user attempt does *not* contain the
Expand All @@ -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

Expand Down
4 changes: 3 additions & 1 deletion docs/labs/mass-test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down