These files are the executable form of the specification. Every implementation in this repository runs all of them; an implementation conforms when all pass.
Each *.json file (except schema.json, which describes the format) is an array of groups:
[
{
"description": "report fails when the test is truthy",
"schema": { "report": { "test": ".total < 0", "message": "negative total" } },
"tests": [
{ "description": "positive total", "data": { "total": 5 }, "valid": true },
{ "description": "negative total", "data": { "total": -1 }, "valid": false,
"errors": [ "negative total" ] }
]
},
{ "description": "invalid jq in assert", "schema": { "assert": ".a |" }, "buildError": true }
]
schema is a JSON Schema (draft 2020-12) using the Jsontron keywords.buildError: true passes when compiling the schema fails.data must validate as valid says.errors, when present, is the list of failure texts of the Jsontron keywords (rules,
assert, report) for that instance. A runner collects the messages of the validation
errors those keywords raised, at any schema location, and compares the two lists sorted:
the order in which a host visits schema locations is not part of the contract. Errors of
standard keywords are ignored.errors checks validity only: the failure comes from an
evaluation error, whose text is not normative, or from a standard keyword.| Implementation | Command |
|---|---|
| .NET | dnx --yes retest at the repository root |
| JavaScript | npm test in js/ |
| Python | pytest in python/ |
Add the group to the file of its area, or a new file: runners pick up every *.json here.
A case must follow from the specification; when it shows the specification is silent or
ambiguous, change the specification in the same commit.