Skip to content

Commit 22f5ac5

Browse files
catamorphismeemeli
andauthored
Add table of errors to test README (#706) (#850)
* Add table of errors to test README (#706) * Update test/README.md Co-authored-by: Eemeli Aro <[email protected]> * Reverse table --------- Co-authored-by: Eemeli Aro <[email protected]>
1 parent c116475 commit 22f5ac5

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

test/README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ These test files are intended to be useful for testing multiple different messag
77

88
- `syntax-errors.json` — Strings that should produce a Syntax Error when parsed.
99

10-
- `data-model-errors.json` - Strings that should produce Data Model Error when processed.
10+
- `data-model-errors.json` - Strings that should produce a Data Model Error when processed.
1111
Error names are defined in ["MessageFormat 2.0 Errors"](../spec/errors.md) in the spec.
1212

1313
- `functions/` — Test cases that correspond to built-in functions.
@@ -21,8 +21,32 @@ Some examples of test harnesses using these tests, from the source repository:
2121
- [Formatting tests](https://github.com/messageformat/messageformat/blob/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/messageformat.test.ts)
2222

2323
A [JSON schema](./schemas/) is included for the test files in this repository.
24-
25-
For users of Visual Studio Code, a [settings file](./.vscode/settings.json) is included that enables schema validation while editing the test files.
24+
## Error Codes
25+
26+
The following table relates the error names used in the [JSON schema](./schemas/)
27+
to the error names used in ["MessageFormat 2.0 Errors"](../spec/errors.md) in the spec.
28+
29+
| Spec | Schema |
30+
| --------------------------- | --------------------------- |
31+
| Bad Operand | bad-operand |
32+
| Bad Option | bad-option |
33+
| Bad Selector | bad-selector |
34+
| Bad Variant Key | bad-variant-key |
35+
| Duplicate Declaration | duplicate-declaration |
36+
| Duplicate Option Name | duplicate-option-name |
37+
| Missing Fallback Variant | missing-fallback-variant |
38+
| Missing Selector Annotation | missing-selector-annotation |
39+
| Syntax Error | syntax-error |
40+
| Unknown Function | unknown-function |
41+
| Unresolved Variable | unresolved-variable |
42+
| Unsupported Expression | unsupported-expression |
43+
| Unsupported Statement | unsupported-statement |
44+
| Variant Key Mismatch | variant-key-mismatch |
45+
46+
The "Message Function Error" error name used in the spec
47+
is not included in the schema,
48+
as it is intended to be an umbrella category
49+
for implementation-specific errors.
2650

2751
## Test Functions
2852

0 commit comments

Comments
 (0)