Skip to content

Commit 82d0e4f

Browse files
committed
document format
1 parent e9b742d commit 82d0e4f

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,36 @@ By running `generate.sh` (which is equivalent to running `deno task generate-tes
9090
* [textualized](src/languages/testLanguage.txt), and
9191
* [rendered as PlantUML diagram](src/languages/testLanguage.puml).
9292

93+
94+
## Test data for serialization format validators
95+
96+
The [`testset/`](testset) directory contains test data that can be used to test validators that validate whether serialization chunks (JSON files) conform to the serialization format specification.
97+
The subdirectory [`withoutLanguage/`](testset/withoutLanguage) pertains to serialization chunks that are to be validated *without* a registered language.
98+
The subdirectory [`withLanguage/`](testset/withLanguage) pertains to serialization chunks that are to be validated *against* a registered language — m.n. the one serialized as [`myLang.language.json`](testset/withLanguage/myLang.language.json).
99+
Either subdirectories contain two subdirectories named `valid` and `invalid`.
100+
Each (nested) subdirectory under `invalid` contains a `__TestExpectation.json` file which specifies which chunk fails validation, and if so, with which error type.
101+
The format of the `__TestExpectation.json` files is as follows:
102+
103+
```json lines
104+
{
105+
"errors": [
106+
{
107+
"file": "<file next to __TestExpectation.json>",
108+
"error": "<error type>"
109+
},
110+
...
111+
]
112+
}
113+
```
114+
115+
Consider the following example of a member of the `errors` array:
116+
117+
```json
118+
{
119+
"file": "empty.json",
120+
"error": "PropertyValueIncorrect"
121+
}
122+
```
123+
124+
This means that validating the `empty.json` file is expected to produce an error of type `PropertyValueIncorrect` (and that it’s the first one produced).
125+

0 commit comments

Comments
 (0)