@toon-format/spec 1.3.3 → 1.5.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.
- package/CHANGELOG.md +28 -0
- package/README.md +15 -3
- package/SPEC.md +435 -102
- package/VERSIONING.md +1 -14
- package/package.json +1 -1
- package/tests/README.md +42 -28
- package/tests/fixtures/decode/arrays-nested.json +20 -20
- package/tests/fixtures/decode/arrays-primitive.json +14 -14
- package/tests/fixtures/decode/arrays-tabular.json +28 -5
- package/tests/fixtures/decode/blank-lines.json +14 -14
- package/tests/fixtures/decode/delimiters.json +46 -29
- package/tests/fixtures/decode/indentation-errors.json +16 -29
- package/tests/fixtures/decode/numbers.json +142 -0
- package/tests/fixtures/decode/objects.json +29 -29
- package/tests/fixtures/decode/path-expansion.json +173 -0
- package/tests/fixtures/decode/primitives.json +44 -75
- package/tests/fixtures/decode/root-form.json +17 -0
- package/tests/fixtures/decode/validation-errors.json +29 -9
- package/tests/fixtures/decode/whitespace.json +61 -0
- package/tests/fixtures/encode/arrays-nested.json +15 -15
- package/tests/fixtures/encode/arrays-objects.json +16 -16
- package/tests/fixtures/encode/arrays-primitive.json +14 -14
- package/tests/fixtures/encode/arrays-tabular.json +8 -8
- package/tests/fixtures/encode/delimiters.json +23 -23
- package/tests/fixtures/encode/key-folding.json +218 -0
- package/tests/fixtures/encode/objects.json +27 -27
- package/tests/fixtures/encode/options.json +1 -1
- package/tests/fixtures/encode/primitives.json +61 -36
- package/tests/fixtures/encode/whitespace.json +18 -3
- package/tests/fixtures.schema.json +20 -4
- package/tests/fixtures/encode/normalization.json +0 -107
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "decode",
|
|
4
4
|
"description": "Delimiter decoding - tab and pipe delimiter parsing, delimiter-aware value splitting",
|
|
5
5
|
"tests": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"expected": {
|
|
10
10
|
"tags": ["reading", "gaming", "coding"]
|
|
11
11
|
},
|
|
12
|
-
"specSection": "
|
|
12
|
+
"specSection": "11"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "parses primitive arrays with pipe delimiter",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"expected": {
|
|
18
18
|
"tags": ["reading", "gaming", "coding"]
|
|
19
19
|
},
|
|
20
|
-
"specSection": "
|
|
20
|
+
"specSection": "11"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"name": "parses primitive arrays with comma delimiter",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"expected": {
|
|
26
26
|
"tags": ["reading", "gaming", "coding"]
|
|
27
27
|
},
|
|
28
|
-
"specSection": "
|
|
28
|
+
"specSection": "11"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "parses tabular arrays with tab delimiter",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
{ "sku": "B2", "qty": 1, "price": 14.5 }
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
|
-
"specSection": "
|
|
39
|
+
"specSection": "11"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "parses tabular arrays with pipe delimiter",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
{ "sku": "B2", "qty": 1, "price": 14.5 }
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
|
-
"specSection": "
|
|
50
|
+
"specSection": "11"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"name": "parses nested arrays with tab delimiter",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"expected": {
|
|
56
56
|
"pairs": [["a", "b"], ["c", "d"]]
|
|
57
57
|
},
|
|
58
|
-
"specSection": "
|
|
58
|
+
"specSection": "11"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"name": "parses nested arrays with pipe delimiter",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"expected": {
|
|
64
64
|
"pairs": [["a", "b"], ["c", "d"]]
|
|
65
65
|
},
|
|
66
|
-
"specSection": "
|
|
66
|
+
"specSection": "11"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"name": "nested arrays inside list items default to comma delimiter",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"expected": {
|
|
72
72
|
"items": [{ "tags": ["a", "b", "c"] }]
|
|
73
73
|
},
|
|
74
|
-
"specSection": "
|
|
74
|
+
"specSection": "11",
|
|
75
75
|
"note": "Parent uses tab, nested defaults to comma"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
@@ -80,31 +80,31 @@
|
|
|
80
80
|
"expected": {
|
|
81
81
|
"items": [{ "tags": ["a", "b", "c"] }]
|
|
82
82
|
},
|
|
83
|
-
"specSection": "
|
|
83
|
+
"specSection": "11"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
"name": "parses root arrays with tab delimiter",
|
|
87
87
|
"input": "[3\t]: x\ty\tz",
|
|
88
88
|
"expected": ["x", "y", "z"],
|
|
89
|
-
"specSection": "
|
|
89
|
+
"specSection": "11"
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
"name": "parses root arrays with pipe delimiter",
|
|
93
93
|
"input": "[3|]: x|y|z",
|
|
94
94
|
"expected": ["x", "y", "z"],
|
|
95
|
-
"specSection": "
|
|
95
|
+
"specSection": "11"
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"name": "parses root arrays of objects with tab delimiter",
|
|
99
99
|
"input": "[2\t]{id}:\n 1\n 2",
|
|
100
100
|
"expected": [{ "id": 1 }, { "id": 2 }],
|
|
101
|
-
"specSection": "
|
|
101
|
+
"specSection": "11"
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
"name": "parses root arrays of objects with pipe delimiter",
|
|
105
105
|
"input": "[2|]{id}:\n 1\n 2",
|
|
106
106
|
"expected": [{ "id": 1 }, { "id": 2 }],
|
|
107
|
-
"specSection": "
|
|
107
|
+
"specSection": "11"
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
"name": "parses values containing tab delimiter when quoted",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"expected": {
|
|
113
113
|
"items": ["a", "b\tc", "d"]
|
|
114
114
|
},
|
|
115
|
-
"specSection": "
|
|
115
|
+
"specSection": "11"
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
"name": "parses values containing pipe delimiter when quoted",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"expected": {
|
|
121
121
|
"items": ["a", "b|c", "d"]
|
|
122
122
|
},
|
|
123
|
-
"specSection": "
|
|
123
|
+
"specSection": "11"
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
"name": "does not split on commas when using tab delimiter",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"expected": {
|
|
129
129
|
"items": ["a,b", "c,d"]
|
|
130
130
|
},
|
|
131
|
-
"specSection": "
|
|
131
|
+
"specSection": "11"
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
"name": "does not split on commas when using pipe delimiter",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"expected": {
|
|
137
137
|
"items": ["a,b", "c,d"]
|
|
138
138
|
},
|
|
139
|
-
"specSection": "
|
|
139
|
+
"specSection": "11"
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
"name": "parses tabular values containing comma with comma delimiter",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
{ "id": 2, "note": "c,d" }
|
|
148
148
|
]
|
|
149
149
|
},
|
|
150
|
-
"specSection": "
|
|
150
|
+
"specSection": "11"
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
"name": "does not require quoting commas with tab delimiter",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
{ "id": 2, "note": "c,d" }
|
|
159
159
|
]
|
|
160
160
|
},
|
|
161
|
-
"specSection": "
|
|
161
|
+
"specSection": "11"
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
"name": "does not require quoting commas in object values",
|
|
@@ -166,16 +166,33 @@
|
|
|
166
166
|
"expected": {
|
|
167
167
|
"note": "a,b"
|
|
168
168
|
},
|
|
169
|
-
"specSection": "
|
|
169
|
+
"specSection": "11",
|
|
170
170
|
"note": "Object values don't require comma quoting regardless of delimiter"
|
|
171
171
|
},
|
|
172
|
+
{
|
|
173
|
+
"name": "object values in list items follow document delimiter",
|
|
174
|
+
"input": "items[2\t]:\n - status: a,b\n - status: c,d",
|
|
175
|
+
"expected": {
|
|
176
|
+
"items": [{ "status": "a,b" }, { "status": "c,d" }]
|
|
177
|
+
},
|
|
178
|
+
"specSection": "11",
|
|
179
|
+
"note": "Active delimiter is tab, but object values use document delimiter for quoting"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "object values with comma must be quoted when document delimiter is comma",
|
|
183
|
+
"input": "items[2]:\n - status: \"a,b\"\n - status: \"c,d\"",
|
|
184
|
+
"expected": {
|
|
185
|
+
"items": [{ "status": "a,b" }, { "status": "c,d" }]
|
|
186
|
+
},
|
|
187
|
+
"specSection": "11"
|
|
188
|
+
},
|
|
172
189
|
{
|
|
173
190
|
"name": "parses nested array values containing pipe delimiter",
|
|
174
191
|
"input": "pairs[1|]:\n - [2|]: a|\"b|c\"",
|
|
175
192
|
"expected": {
|
|
176
193
|
"pairs": [["a", "b|c"]]
|
|
177
194
|
},
|
|
178
|
-
"specSection": "
|
|
195
|
+
"specSection": "11"
|
|
179
196
|
},
|
|
180
197
|
{
|
|
181
198
|
"name": "parses nested array values containing tab delimiter",
|
|
@@ -183,7 +200,7 @@
|
|
|
183
200
|
"expected": {
|
|
184
201
|
"pairs": [["a", "b\tc"]]
|
|
185
202
|
},
|
|
186
|
-
"specSection": "
|
|
203
|
+
"specSection": "11"
|
|
187
204
|
},
|
|
188
205
|
{
|
|
189
206
|
"name": "preserves quoted ambiguity with pipe delimiter",
|
|
@@ -191,7 +208,7 @@
|
|
|
191
208
|
"expected": {
|
|
192
209
|
"items": ["true", "42", "-3.14"]
|
|
193
210
|
},
|
|
194
|
-
"specSection": "
|
|
211
|
+
"specSection": "11"
|
|
195
212
|
},
|
|
196
213
|
{
|
|
197
214
|
"name": "preserves quoted ambiguity with tab delimiter",
|
|
@@ -199,7 +216,7 @@
|
|
|
199
216
|
"expected": {
|
|
200
217
|
"items": ["true", "42", "-3.14"]
|
|
201
218
|
},
|
|
202
|
-
"specSection": "
|
|
219
|
+
"specSection": "11"
|
|
203
220
|
},
|
|
204
221
|
{
|
|
205
222
|
"name": "parses structural-looking strings when quoted with pipe delimiter",
|
|
@@ -207,7 +224,7 @@
|
|
|
207
224
|
"expected": {
|
|
208
225
|
"items": ["[5]", "{key}", "- item"]
|
|
209
226
|
},
|
|
210
|
-
"specSection": "
|
|
227
|
+
"specSection": "11"
|
|
211
228
|
},
|
|
212
229
|
{
|
|
213
230
|
"name": "parses structural-looking strings when quoted with tab delimiter",
|
|
@@ -215,7 +232,7 @@
|
|
|
215
232
|
"expected": {
|
|
216
233
|
"items": ["[5]", "{key}", "- item"]
|
|
217
234
|
},
|
|
218
|
-
"specSection": "
|
|
235
|
+
"specSection": "11"
|
|
219
236
|
},
|
|
220
237
|
{
|
|
221
238
|
"name": "parses tabular headers with keys containing the active delimiter",
|
|
@@ -223,7 +240,7 @@
|
|
|
223
240
|
"expected": {
|
|
224
241
|
"items": [{ "a|b": 1 }, { "a|b": 2 }]
|
|
225
242
|
},
|
|
226
|
-
"specSection": "
|
|
243
|
+
"specSection": "11"
|
|
227
244
|
},
|
|
228
245
|
{
|
|
229
246
|
"name": "accepts length marker with pipe delimiter",
|
|
@@ -231,7 +248,7 @@
|
|
|
231
248
|
"expected": {
|
|
232
249
|
"tags": ["reading", "gaming", "coding"]
|
|
233
250
|
},
|
|
234
|
-
"specSection": "
|
|
251
|
+
"specSection": "6"
|
|
235
252
|
}
|
|
236
253
|
]
|
|
237
254
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4",
|
|
3
3
|
"category": "decode",
|
|
4
4
|
"description": "Strict mode indentation validation - non-multiple indentation, tab characters, custom indent sizes",
|
|
5
5
|
"tests": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"indent": 2,
|
|
13
13
|
"strict": true
|
|
14
14
|
},
|
|
15
|
-
"specSection": "
|
|
15
|
+
"specSection": "14.3"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "throws when list item has non-multiple indentation (3 spaces with indent=2)",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"indent": 2,
|
|
24
24
|
"strict": true
|
|
25
25
|
},
|
|
26
|
-
"specSection": "
|
|
26
|
+
"specSection": "14.3"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"name": "throws with custom indent size when non-multiple (3 spaces with indent=4)",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"indent": 4,
|
|
35
35
|
"strict": true
|
|
36
36
|
},
|
|
37
|
-
"specSection": "
|
|
37
|
+
"specSection": "14.3"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
"name": "accepts correct indentation with custom indent size (4 spaces with indent=4)",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"indent": 4,
|
|
49
49
|
"strict": true
|
|
50
50
|
},
|
|
51
|
-
"specSection": "
|
|
51
|
+
"specSection": "12"
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
"name": "throws when tab character used in indentation",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"options": {
|
|
59
59
|
"strict": true
|
|
60
60
|
},
|
|
61
|
-
"specSection": "
|
|
61
|
+
"specSection": "14.3"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"name": "throws when mixed tabs and spaces in indentation",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"options": {
|
|
69
69
|
"strict": true
|
|
70
70
|
},
|
|
71
|
-
"specSection": "
|
|
71
|
+
"specSection": "14.3"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"name": "throws when tab at start of line",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"options": {
|
|
79
79
|
"strict": true
|
|
80
80
|
},
|
|
81
|
-
"specSection": "
|
|
81
|
+
"specSection": "14.3"
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"name": "accepts tabs in quoted string values",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"options": {
|
|
90
90
|
"strict": true
|
|
91
91
|
},
|
|
92
|
-
"specSection": "
|
|
92
|
+
"specSection": "12"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"name": "accepts tabs in quoted keys",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"options": {
|
|
101
101
|
"strict": true
|
|
102
102
|
},
|
|
103
|
-
"specSection": "
|
|
103
|
+
"specSection": "12"
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"name": "accepts tabs in quoted array elements",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"options": {
|
|
112
112
|
"strict": true
|
|
113
113
|
},
|
|
114
|
-
"specSection": "
|
|
114
|
+
"specSection": "12"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"name": "accepts non-multiple indentation when strict=false",
|
|
@@ -125,20 +125,7 @@
|
|
|
125
125
|
"indent": 2,
|
|
126
126
|
"strict": false
|
|
127
127
|
},
|
|
128
|
-
"specSection": "
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"name": "accepts tab indentation when strict=false (tabs ignored, depth=0)",
|
|
132
|
-
"input": "a:\n\tb: 1",
|
|
133
|
-
"expected": {
|
|
134
|
-
"a": {},
|
|
135
|
-
"b": 1
|
|
136
|
-
},
|
|
137
|
-
"options": {
|
|
138
|
-
"strict": false
|
|
139
|
-
},
|
|
140
|
-
"specSection": "9",
|
|
141
|
-
"note": "Tabs are ignored in indentation counting, so b appears at root level"
|
|
128
|
+
"specSection": "12"
|
|
142
129
|
},
|
|
143
130
|
{
|
|
144
131
|
"name": "accepts deeply nested non-multiples when strict=false",
|
|
@@ -154,7 +141,7 @@
|
|
|
154
141
|
"indent": 2,
|
|
155
142
|
"strict": false
|
|
156
143
|
},
|
|
157
|
-
"specSection": "
|
|
144
|
+
"specSection": "12"
|
|
158
145
|
},
|
|
159
146
|
{
|
|
160
147
|
"name": "empty lines do not trigger validation errors",
|
|
@@ -166,7 +153,7 @@
|
|
|
166
153
|
"options": {
|
|
167
154
|
"strict": true
|
|
168
155
|
},
|
|
169
|
-
"specSection": "
|
|
156
|
+
"specSection": "12"
|
|
170
157
|
},
|
|
171
158
|
{
|
|
172
159
|
"name": "root-level content (0 indentation) is always valid",
|
|
@@ -179,7 +166,7 @@
|
|
|
179
166
|
"options": {
|
|
180
167
|
"strict": true
|
|
181
168
|
},
|
|
182
|
-
"specSection": "
|
|
169
|
+
"specSection": "12"
|
|
183
170
|
},
|
|
184
171
|
{
|
|
185
172
|
"name": "lines with only spaces are not validated if empty",
|
|
@@ -191,7 +178,7 @@
|
|
|
191
178
|
"options": {
|
|
192
179
|
"strict": true
|
|
193
180
|
},
|
|
194
|
-
"specSection": "
|
|
181
|
+
"specSection": "12"
|
|
195
182
|
}
|
|
196
183
|
]
|
|
197
184
|
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.4",
|
|
3
|
+
"category": "decode",
|
|
4
|
+
"description": "Number decoding edge cases - trailing zeros, exponent forms, negative zero",
|
|
5
|
+
"tests": [
|
|
6
|
+
{
|
|
7
|
+
"name": "parses number with trailing zeros in fractional part",
|
|
8
|
+
"input": "value: 1.5000",
|
|
9
|
+
"expected": {
|
|
10
|
+
"value": 1.5
|
|
11
|
+
},
|
|
12
|
+
"specSection": "4",
|
|
13
|
+
"note": "Decoders accept trailing zeros; numeric value is 1.5"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "parses negative number with positive exponent",
|
|
17
|
+
"input": "value: -1E+03",
|
|
18
|
+
"expected": {
|
|
19
|
+
"value": -1000
|
|
20
|
+
},
|
|
21
|
+
"specSection": "4",
|
|
22
|
+
"note": "Exponent forms are accepted by decoders"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "parses lowercase exponent",
|
|
26
|
+
"input": "value: 2.5e2",
|
|
27
|
+
"expected": {
|
|
28
|
+
"value": 250
|
|
29
|
+
},
|
|
30
|
+
"specSection": "4"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "parses uppercase exponent with negative sign",
|
|
34
|
+
"input": "value: 3E-02",
|
|
35
|
+
"expected": {
|
|
36
|
+
"value": 0.03
|
|
37
|
+
},
|
|
38
|
+
"specSection": "4"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "parses negative zero as zero",
|
|
42
|
+
"input": "value: -0",
|
|
43
|
+
"expected": {
|
|
44
|
+
"value": 0
|
|
45
|
+
},
|
|
46
|
+
"specSection": "4",
|
|
47
|
+
"note": "Negative zero decodes to 0; most host environments do not distinguish -0 from 0"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "parses negative zero with fractional part",
|
|
51
|
+
"input": "value: -0.0",
|
|
52
|
+
"expected": {
|
|
53
|
+
"value": 0
|
|
54
|
+
},
|
|
55
|
+
"specSection": "4"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "parses array with mixed numeric forms",
|
|
59
|
+
"input": "nums[5]: 42,-1E+03,1.5000,-0,2.5e2",
|
|
60
|
+
"expected": {
|
|
61
|
+
"nums": [42, -1000, 1.5, 0, 250]
|
|
62
|
+
},
|
|
63
|
+
"specSection": "4",
|
|
64
|
+
"note": "Decoders normalize all numeric forms to host numeric values"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "treats leading zero as string not number",
|
|
68
|
+
"input": "value: 05",
|
|
69
|
+
"expected": {
|
|
70
|
+
"value": "05"
|
|
71
|
+
},
|
|
72
|
+
"specSection": "4",
|
|
73
|
+
"note": "Forbidden leading zeros cause tokens to be treated as strings"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "parses very small exponent",
|
|
77
|
+
"input": "value: 1e-10",
|
|
78
|
+
"expected": {
|
|
79
|
+
"value": 0.0000000001
|
|
80
|
+
},
|
|
81
|
+
"specSection": "4"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "parses integer with positive exponent",
|
|
85
|
+
"input": "value: 5E+00",
|
|
86
|
+
"expected": {
|
|
87
|
+
"value": 5
|
|
88
|
+
},
|
|
89
|
+
"specSection": "4",
|
|
90
|
+
"note": "Exponent +00 results in the integer 5"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "parses exponent notation",
|
|
94
|
+
"input": "1e6",
|
|
95
|
+
"expected": 1000000,
|
|
96
|
+
"specSection": "4"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "parses exponent notation with uppercase E",
|
|
100
|
+
"input": "1E+6",
|
|
101
|
+
"expected": 1000000,
|
|
102
|
+
"specSection": "4"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "parses negative exponent notation",
|
|
106
|
+
"input": "-1e-3",
|
|
107
|
+
"expected": -0.001,
|
|
108
|
+
"specSection": "4"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "treats unquoted leading-zero number as string",
|
|
112
|
+
"input": "05",
|
|
113
|
+
"expected": "05",
|
|
114
|
+
"specSection": "4",
|
|
115
|
+
"note": "Leading zeros make it a string"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "treats unquoted multi-leading-zero as string",
|
|
119
|
+
"input": "007",
|
|
120
|
+
"expected": "007",
|
|
121
|
+
"specSection": "4"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "treats unquoted octal-like as string",
|
|
125
|
+
"input": "0123",
|
|
126
|
+
"expected": "0123",
|
|
127
|
+
"specSection": "4"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "treats leading-zero in object value as string",
|
|
131
|
+
"input": "a: 05",
|
|
132
|
+
"expected": { "a": "05" },
|
|
133
|
+
"specSection": "4"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "treats leading-zeros in array as strings",
|
|
137
|
+
"input": "nums[3]: 05,007,0123",
|
|
138
|
+
"expected": { "nums": ["05", "007", "0123"] },
|
|
139
|
+
"specSection": "4"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|