Skip to content

Commit b9fb07b

Browse files
committed
Update error types
1 parent 0727525 commit b9fb07b

File tree

10 files changed

+181
-88
lines changed

10 files changed

+181
-88
lines changed

test/schemas/v0-0-1/tests.schema.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,21 @@
388388
"properties": {
389389
"type": {
390390
"enum": [
391-
"bad-input",
392-
"bad-option",
393-
"missing-func",
394-
"not-selectable",
395-
"range-error",
396-
"unresolved-var",
397-
"unsupported-annotation",
398-
"unsupported-statement"
391+
"syntax-error",
392+
"variant-key-mismatch",
393+
"missing-fallback-variant",
394+
"missing-selector-annotation",
395+
"duplicate-declaration",
396+
"duplicate-option-name",
397+
"unresolved-variable",
398+
"unknown-function",
399+
"unsupported-expression",
400+
"invalid-expression",
401+
"operand-mismatch",
402+
"unsupported-statement",
403+
"selection-error",
404+
"formatting-error",
405+
"bad-input"
399406
]
400407
}
401408
}

test/tests/data-model-errors.json

Lines changed: 128 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,89 +3,168 @@
33
"description": "Each `src` should produce an error when processed. Each test description indicates the error reason, but this text should not be asserted against. Error names are defined in the spec.",
44
"defaultTestProperties": {
55
"testType": "syntax",
6-
"locale": "en-US",
7-
"expErrors": true
6+
"locale": "en-US"
87
},
98
"tests": [
109
{
11-
"description": "Variant Key Mismatch",
12-
"src": ".match {$foo :x} * * {{foo}}"
10+
"src": ".match {$foo :x} * * {{foo}}",
11+
"expErrors": [
12+
{
13+
"type": "variant-key-mismatch"
14+
}
15+
]
1316
},
1417
{
15-
"description": "Variant Key Mismatch",
16-
"src": ".match {$foo :x} {$bar :x} * {{foo}}"
18+
"src": ".match {$foo :x} {$bar :x} * {{foo}}",
19+
"expErrors": [
20+
{
21+
"type": "variant-key-mismatch"
22+
}
23+
]
1724
},
1825
{
19-
"description": "Missing Fallback Variant",
20-
"src": ".match {:foo} 1 {{_}}"
26+
"src": ".match {:foo} 1 {{_}}",
27+
"expErrors": [
28+
{
29+
"type": "missing-fallback-variant"
30+
}
31+
]
2132
},
2233
{
23-
"description": "Missing Fallback Variant",
24-
"src": ".match {:foo} other {{_}}"
34+
"src": ".match {:foo} other {{_}}",
35+
"expErrors": [
36+
{
37+
"type": "missing-fallback-variant"
38+
}
39+
]
2540
},
2641
{
27-
"description": "Missing Fallback Variant",
28-
"src": ".match {:foo} {:bar} * 1 {{_}} 1 * {{_}}"
42+
"src": ".match {:foo} {:bar} * 1 {{_}} 1 * {{_}}",
43+
"expErrors": [
44+
{
45+
"type": "missing-fallback-variant"
46+
}
47+
]
2948
},
3049
{
31-
"description": "Missing Selector Annotation",
32-
"src": ".match {$foo} one {{one}} * {{other}}"
50+
"src": ".match {$foo} one {{one}} * {{other}}",
51+
"expErrors": [
52+
{
53+
"type": "missing-selector-annotation"
54+
}
55+
]
3356
},
3457
{
35-
"description": "Missing Selector Annotation",
36-
"src": ".input {$foo} .match {$foo} one {{one}} * {{other}}"
58+
"src": ".input {$foo} .match {$foo} one {{one}} * {{other}}",
59+
"expErrors": [
60+
{
61+
"type": "missing-selector-annotation"
62+
}
63+
]
3764
},
3865
{
39-
"description": "Missing Selector Annotation",
40-
"src": ".local $foo = {$bar} .match {$foo} one {{one}} * {{other}}"
66+
"src": ".local $foo = {$bar} .match {$foo} one {{one}} * {{other}}",
67+
"expErrors": [
68+
{
69+
"type": "missing-selector-annotation"
70+
}
71+
]
4172
},
4273
{
43-
"description": "Duplicate Declaration",
44-
"src": ".input {$foo} .input {$foo} {{_}}"
74+
"src": ".input {$foo} .input {$foo} {{_}}",
75+
"expErrors": [
76+
{
77+
"type": "duplicate-declaration"
78+
}
79+
]
4580
},
4681
{
47-
"description": "Duplicate Declaration",
48-
"src": ".input {$foo} .local $foo = {42} {{_}}"
82+
"src": ".input {$foo} .local $foo = {42} {{_}}",
83+
"expErrors": [
84+
{
85+
"type": "duplicate-declaration"
86+
}
87+
]
4988
},
5089
{
51-
"description": "Duplicate Declaration",
52-
"src": ".local $foo = {42} .input {$foo} {{_}}"
90+
"src": ".local $foo = {42} .input {$foo} {{_}}",
91+
"expErrors": [
92+
{
93+
"type": "duplicate-declaration"
94+
}
95+
]
5396
},
5497
{
55-
"description": "Duplicate Declaration",
56-
"src": ".local $foo = {:unknown} .local $foo = {42} {{_}}"
98+
"src": ".local $foo = {:unknown} .local $foo = {42} {{_}}",
99+
"expErrors": [
100+
{
101+
"type": "duplicate-declaration"
102+
}
103+
]
57104
},
58105
{
59-
"description": "Duplicate Declaration",
60-
"src": ".local $foo = {$bar} .local $bar = {42} {{_}}"
61-
},
106+
"src": ".local $foo = {$bar} .local $bar = {42} {{_}}",
107+
"expErrors": [
108+
{
109+
"type": "duplicate-declaration"
110+
}
111+
]
112+
},
62113
{
63-
"description": "Duplicate Declaration",
64-
"src": ".local $foo = {$foo} {{_}}"
65-
},
114+
"src": ".local $foo = {$foo} {{_}}",
115+
"expErrors": [
116+
{
117+
"type": "duplicate-declaration"
118+
}
119+
]
120+
},
66121
{
67-
"description": "Duplicate Declaration",
68-
"src": ".local $foo = {$bar} .local $bar = {$baz} {{_}}"
69-
},
122+
"src": ".local $foo = {$bar} .local $bar = {$baz} {{_}}",
123+
"expErrors": [
124+
{
125+
"type": "duplicate-declaration"
126+
}
127+
]
128+
},
70129
{
71-
"description": "Duplicate Declaration",
72-
"src": ".local $foo = {$bar :func} .local $bar = {$baz} {{_}}"
73-
},
130+
"src": ".local $foo = {$bar :func} .local $bar = {$baz} {{_}}",
131+
"expErrors": [
132+
{
133+
"type": "duplicate-declaration"
134+
}
135+
]
136+
},
74137
{
75-
"description": "Duplicate Declaration",
76-
"src": ".local $foo = {42 :func opt=$foo} {{_}}"
77-
},
138+
"src": ".local $foo = {42 :func opt=$foo} {{_}}",
139+
"expErrors": [
140+
{
141+
"type": "duplicate-declaration"
142+
}
143+
]
144+
},
78145
{
79-
"description": "Duplicate Declaration",
80-
"src": ".local $foo = {42 :func opt=$bar} .local $bar = {42} {{_}}"
81-
},
146+
"src": ".local $foo = {42 :func opt=$bar} .local $bar = {42} {{_}}",
147+
"expErrors": [
148+
{
149+
"type": "duplicate-declaration"
150+
}
151+
]
152+
},
82153
{
83-
"description": "Duplicate Option Name",
84-
"src": "bad {:placeholder option=x option=x}"
85-
},
154+
"src": "bad {:placeholder option=x option=x}",
155+
"expErrors": [
156+
{
157+
"type": "duplicate-option-name"
158+
}
159+
]
160+
},
86161
{
87-
"description": "Duplicate Option Name",
88-
"src": "bad {:placeholder ns:option=x ns:option=y}"
162+
"src": "bad {:placeholder ns:option=x ns:option=y}",
163+
"expErrors": [
164+
{
165+
"type": "duplicate-option-name"
166+
}
167+
]
89168
}
90169
]
91170
}

test/tests/functions/date.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"scenario": "Date functions",
3-
"description": "The behaviour of built-in formatters is implementation-specific so the `exp` field is often omitted and assertions are made on error cases.",
2+
"scenario": "Date function",
3+
"description": "The built-in formatter for dates.",
44
"defaultTestProperties": {
55
"testType": "function",
66
"locale": "en-US",
@@ -12,7 +12,7 @@
1212
"exp": "{:date}",
1313
"expErrors": [
1414
{
15-
"type": "bad-input"
15+
"type": "invalid-expression"
1616
}
1717
]
1818
},
@@ -21,7 +21,7 @@
2121
"exp": "{|horse|}",
2222
"expErrors": [
2323
{
24-
"type": "bad-input"
24+
"type": "operand-mismatch"
2525
}
2626
]
2727
},

test/tests/functions/datetime.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"scenario": "Datetime functions",
3-
"description": "The behaviour of built-in formatters is implementation-specific so the `exp` field is often omitted and assertions are made on error cases.",
2+
"scenario": "Datetime function",
3+
"description": "The built-in formatter for datetimes.",
44
"defaultTestProperties": {
55
"testType": "function",
66
"locale": "en-US",
@@ -12,7 +12,7 @@
1212
"exp": "{:datetime}",
1313
"expErrors": [
1414
{
15-
"type": "bad-input"
15+
"type": "invalid-expression"
1616
}
1717
]
1818
},
@@ -36,7 +36,7 @@
3636
"exp": "{|horse|}",
3737
"expErrors": [
3838
{
39-
"type": "range-error"
39+
"type": "operand-mismatch"
4040
}
4141
]
4242
},

test/tests/functions/integer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"scenario": "Integer functions",
2+
"scenario": "Integer function",
3+
"description": "The built-in formatter for integers.",
34
"defaultTestProperties": {
45
"testType": "function",
56
"locale": "en-US"

0 commit comments

Comments
 (0)