Skip to content

Commit 176da69

Browse files
Document using 'null' in hint tests
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 4614921 commit 176da69

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

docs/labs/create_checker.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -442,18 +442,18 @@ hints: [
442442
absent: ", $",
443443
text: "This is a parameter, it must end with a comma.",
444444
examples: [
445-
[ " " ]
446-
]
445+
[ " " ],
446+
],
447447
},
448448
{
449449
present: "(isint|Isint|IsInt|ISINT)",
450450
text: "JavaScript is case-sensitive. Use isInt instead.",
451451
examples: [
452452
[ " query('id').isint()," ],
453453
[ " query('id').IsInt()," ],
454-
]
455-
}
456-
]
454+
],
455+
},
456+
],
457457
~~~~
458458

459459
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
475475
check them in. That way you won't need to debug a long complicated
476476
set of changes.
477477

478-
Please create tests! You can create test cases for attempts
479-
(`successes` should pass, `failures` should fail), and test cases
480-
to ensure the hints work correctly.
478+
Please create tests! You should create test cases for full attempts
479+
(`successes` should pass, `failures` should fail) and test cases
480+
for hints (`examples`).
481481
Remember, hints are checked in order - it's possible to create a hint
482482
that won't trigger because something earlier would always match.
483-
These tests are automatically checked every time the page is (re)loaded.
483+
All tests are automatically re-run every time the page is (re)loaded.
484+
485+
In a hint, `examples` is an array of examples that should trigger the hint.
486+
Each example is an array of answers. If you use an index, the other index
487+
values aren't considered. We suggest using `null` for array entries
488+
that aren't relevant for the test.
484489

485490
### Debugging
486491

0 commit comments

Comments
 (0)