@curly-message/conformance 1.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,231 @@
1
+ {
2
+ "format": "curly-message-1",
3
+ "level": "core",
4
+ "section": "4",
5
+ "cases": [
6
+ {
7
+ "id": "conversion/plain-object-json",
8
+ "description": "A plain object value is converted with the host's JSON serialization.",
9
+ "section": "4",
10
+ "message": "{{v}}",
11
+ "payload": {
12
+ "v": {
13
+ "a": 1,
14
+ "b": "x"
15
+ }
16
+ },
17
+ "expected": {
18
+ "output": "{\"a\":1,\"b\":\"x\"}"
19
+ }
20
+ },
21
+ {
22
+ "id": "conversion/array-json",
23
+ "description": "An array value is converted with the host's JSON serialization.",
24
+ "section": "4",
25
+ "message": "{{v}}",
26
+ "payload": {
27
+ "v": [
28
+ 1,
29
+ 2
30
+ ]
31
+ },
32
+ "expected": {
33
+ "output": "[1,2]"
34
+ }
35
+ },
36
+ {
37
+ "id": "conversion/nested-json",
38
+ "description": "A structured value serializes whole, the objects, arrays and JSON literals it nests included.",
39
+ "section": "4",
40
+ "message": "{{v}}",
41
+ "payload": {
42
+ "v": {
43
+ "a": {
44
+ "b": [
45
+ 1,
46
+ {
47
+ "c": null
48
+ }
49
+ ]
50
+ },
51
+ "d": true
52
+ }
53
+ },
54
+ "expected": {
55
+ "output": "{\"a\":{\"b\":[1,{\"c\":null}]},\"d\":true}"
56
+ }
57
+ },
58
+ {
59
+ "id": "conversion/empty-array-json",
60
+ "description": "An empty array is a present value that serializes to its own two brackets.",
61
+ "section": "4",
62
+ "message": "{{v; default:D}}",
63
+ "payload": {
64
+ "v": []
65
+ },
66
+ "expected": {
67
+ "output": "[]"
68
+ }
69
+ },
70
+ {
71
+ "id": "conversion/string-not-serialized",
72
+ "description": "A string is converted with the ordinary string conversion, so it reaches the output without the quotes a serialization would add.",
73
+ "section": "4",
74
+ "message": "{{v}}",
75
+ "payload": {
76
+ "v": "a b"
77
+ },
78
+ "expected": {
79
+ "output": "a b"
80
+ }
81
+ },
82
+ {
83
+ "id": "conversion/number-string-conversion",
84
+ "description": "A number reaches the output as the text the host's ordinary string conversion produces.",
85
+ "section": "4",
86
+ "message": "{{v}}",
87
+ "payload": {
88
+ "v": 42
89
+ },
90
+ "expected": {
91
+ "output": "42"
92
+ }
93
+ },
94
+ {
95
+ "id": "conversion/number-reaches-comparison-as-text",
96
+ "description": "A number reaches an option comparison as text, so an option keyed with its spelling matches it.",
97
+ "section": "4",
98
+ "message": "{{v; 42:HIT; default:MISS}}",
99
+ "payload": {
100
+ "v": 42
101
+ },
102
+ "expected": {
103
+ "output": "HIT"
104
+ }
105
+ },
106
+ {
107
+ "id": "conversion/array-reaches-comparison-as-text",
108
+ "description": "A value reaches an option comparison as the text it converts to, an array as its JSON.",
109
+ "section": "4",
110
+ "message": "{{v; [1,2]:HIT; default:MISS}}",
111
+ "payload": {
112
+ "v": [
113
+ 1,
114
+ 2
115
+ ]
116
+ },
117
+ "expected": {
118
+ "output": "HIT"
119
+ }
120
+ },
121
+ {
122
+ "id": "conversion/unserializable-takes-chain",
123
+ "description": "A value no conversion can describe is treated as absent: the placeholder takes the chain, and the condition is reported against the payload.",
124
+ "section": "4",
125
+ "message": "{{v; default:D}}",
126
+ "payload": {
127
+ "v": {
128
+ "$curly": "unserializable"
129
+ }
130
+ },
131
+ "key": "conversion.unserializable",
132
+ "expected": {
133
+ "output": "D",
134
+ "reports": [
135
+ {
136
+ "code": "unserializable-value",
137
+ "origin": "payload",
138
+ "key": "conversion.unserializable"
139
+ }
140
+ ]
141
+ }
142
+ },
143
+ {
144
+ "id": "conversion/unserializable-reads-payload-default",
145
+ "description": "A value no conversion can describe is absent the way a missing entry is, so the payload's own default fills the placeholder.",
146
+ "section": "4",
147
+ "message": "{{v}}",
148
+ "payload": {
149
+ "v": {
150
+ "$curly": "unserializable"
151
+ },
152
+ "default": "P"
153
+ },
154
+ "expected": {
155
+ "output": "P",
156
+ "reports": [
157
+ {
158
+ "code": "unserializable-value",
159
+ "origin": "payload"
160
+ }
161
+ ]
162
+ }
163
+ },
164
+ {
165
+ "id": "conversion/unserializable-without-default",
166
+ "description": "A value no conversion can describe does not raise: with no link of the chain to take, the placeholder is the empty string.",
167
+ "section": "4",
168
+ "message": "[{{v}}]",
169
+ "payload": {
170
+ "v": {
171
+ "$curly": "unserializable"
172
+ }
173
+ },
174
+ "expected": {
175
+ "output": "[]",
176
+ "reports": [
177
+ {
178
+ "code": "unserializable-value",
179
+ "origin": "payload"
180
+ }
181
+ ]
182
+ }
183
+ },
184
+ {
185
+ "id": "conversion/numeric-comparison-converts-text",
186
+ "description": "A numeric comparison converts the value's text with the host's ordinary numeric conversion, so a string spelling a number compares as one.",
187
+ "section": "4",
188
+ "message": "{{v:gt; 1:X; default:D}}",
189
+ "payload": {
190
+ "v": "5"
191
+ },
192
+ "expected": {
193
+ "output": "X"
194
+ }
195
+ },
196
+ {
197
+ "id": "conversion/numeric-comparison-converts-key",
198
+ "description": "An option key is converted numerically the same way, so a key with a fraction orders against the value.",
199
+ "section": "4",
200
+ "message": "{{v:lt; 2.5:X; default:D}}",
201
+ "payload": {
202
+ "v": 2
203
+ },
204
+ "expected": {
205
+ "output": "X"
206
+ }
207
+ },
208
+ {
209
+ "id": "conversion/numeric-conversion-failure-is-no-error",
210
+ "description": "A value whose numeric conversion yields no number fails the comparison and takes the chain, and nothing is reported.",
211
+ "section": "4",
212
+ "message": "{{v:lt; 10:X; default:D}}",
213
+ "payload": {
214
+ "v": "abc"
215
+ },
216
+ "expected": {
217
+ "output": "D",
218
+ "reports": []
219
+ }
220
+ },
221
+ {
222
+ "id": "conversion/message-number",
223
+ "description": "A message a host wrote as a number resolves to a string, the text its conversion produces.",
224
+ "section": "4",
225
+ "message": 42,
226
+ "expected": {
227
+ "output": "42"
228
+ }
229
+ }
230
+ ]
231
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "format": "curly-message-1",
3
+ "level": "extensions",
4
+ "section": "7",
5
+ "cases": [
6
+ {
7
+ "id": "escaping-extensions/modifier-name-colon",
8
+ "description": "A modifier name carries a colon as an escape sequence and is matched after unescaping.",
9
+ "section": "7",
10
+ "message": "{{v:x-a\\:b}}",
11
+ "payload": {
12
+ "v": "hit"
13
+ },
14
+ "modifiers": {
15
+ "x-a:b": "upper"
16
+ },
17
+ "expected": {
18
+ "output": "HIT"
19
+ }
20
+ },
21
+ {
22
+ "id": "escaping-extensions/modifier-name-escaped-space",
23
+ "description": "A space an escape sequence claims is part of the modifier name and is matched with it.",
24
+ "section": "7",
25
+ "message": "{{v:x-c\\ }}",
26
+ "payload": {
27
+ "v": "hit"
28
+ },
29
+ "modifiers": {
30
+ "x-c ": "upper"
31
+ },
32
+ "expected": {
33
+ "output": "HIT"
34
+ }
35
+ },
36
+ {
37
+ "id": "escaping-extensions/modifier-name-keeps-colons",
38
+ "description": "Only the first unescaped colon of the selector separates the key from the modifier name, so a later one needs no escape.",
39
+ "section": "6",
40
+ "message": "{{v:x-a:b}}",
41
+ "payload": {
42
+ "v": "hit"
43
+ },
44
+ "modifiers": {
45
+ "x-a:b": "upper"
46
+ },
47
+ "expected": {
48
+ "output": "HIT"
49
+ }
50
+ },
51
+ {
52
+ "id": "escaping-extensions/modifier-reads-serialization",
53
+ "description": "A modifier reads its input before the removal runs, so it receives the serialization the conversion produced and the output unescapes it once.",
54
+ "section": "7",
55
+ "message": "{{v:echo}}",
56
+ "payload": {
57
+ "v": {
58
+ "a": "x\\:"
59
+ }
60
+ },
61
+ "modifiers": {
62
+ "echo": "echo"
63
+ },
64
+ "expected": {
65
+ "output": "{\"a\":\"x\\:\"}"
66
+ }
67
+ },
68
+ {
69
+ "id": "escaping-extensions/options-handed-unescaped-key",
70
+ "description": "A host-defined modifier is handed an option key unescaped and a valueless option value as its source spelling, which the output unescapes once.",
71
+ "section": "7",
72
+ "message": "{{v:opts; a\\\\\\\\b}}",
73
+ "payload": {
74
+ "v": "x"
75
+ },
76
+ "modifiers": {
77
+ "opts": "options"
78
+ },
79
+ "expected": {
80
+ "output": "a\\b=a\\\\b"
81
+ }
82
+ }
83
+ ]
84
+ }