dbb00ff1ac5b8b0f0c5c4f70c468d6bfcb875475
[liburi-template-perl.git] / t / cases / spec-examples-by-section.json
1 {
2   "3.2.1 Variable Expansion" :
3   {
4     "variables": {
5        "count"      : ["one", "two", "three"],
6        "dom"        : ["example", "com"],
7        "dub"        : "me/too",
8        "hello"      : "Hello World!",
9        "half"       : "50%",
10        "var"        : "value",
11        "who"        : "fred",
12        "base"       : "http://example.com/home/",
13        "path"       : "/foo/bar",
14        "list"       : ["red", "green", "blue"],
15        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
16        "v"          : "6",
17        "x"          : "1024",
18        "y"          : "768",
19        "empty"      : "",
20        "empty_keys" : [],
21        "undef"      : null
22      },
23      "testcases" : [
24         ["{count}", "one,two,three"],
25         ["{count*}", "one,two,three"],
26         ["{/count}", "/one,two,three"],
27         ["{/count*}", "/one/two/three"],
28         ["{;count}", ";count=one,two,three"],
29         ["{;count*}", ";count=one;count=two;count=three"],
30         ["{?count}", "?count=one,two,three"],
31         ["{?count*}", "?count=one&count=two&count=three"],
32         ["{&count*}", "&count=one&count=two&count=three"]
33       ]
34   },
35   "3.2.2 Simple String Expansion" :
36   {
37     "variables": {
38        "count"      : ["one", "two", "three"],
39        "dom"        : ["example", "com"],
40        "dub"        : "me/too",
41        "hello"      : "Hello World!",
42        "half"       : "50%",
43        "var"        : "value",
44        "who"        : "fred",
45        "base"       : "http://example.com/home/",
46        "path"       : "/foo/bar",
47        "list"       : ["red", "green", "blue"],
48        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
49        "v"          : "6",
50        "x"          : "1024",
51        "y"          : "768",
52        "empty"      : "",
53        "empty_keys" : [],
54        "undef"      : null
55      },
56      "testcases" : [
57         ["{var}", "value"],
58         ["{hello}", "Hello%20World%21"],
59         ["{half}", "50%25"],
60         ["O{empty}X", "OX"],
61         ["O{undef}X", "OX"],
62         ["{x,y}", "1024,768"],
63         ["{x,hello,y}", "1024,Hello%20World%21,768"],
64         ["?{x,empty}", "?1024,"],
65         ["?{x,undef}", "?1024"],
66         ["?{undef,y}", "?768"],
67         ["{var:3}", "val"],
68         ["{var:30}", "value"],
69         ["{list}", "red,green,blue"],
70         ["{list*}", "red,green,blue"],
71         ["{keys}", [
72           "comma,%2C,dot,.,semi,%3B",
73           "comma,%2C,semi,%3B,dot,.",
74           "dot,.,comma,%2C,semi,%3B",
75           "dot,.,semi,%3B,comma,%2C",
76           "semi,%3B,comma,%2C,dot,.",
77           "semi,%3B,dot,.,comma,%2C"
78         ]],
79         ["{keys*}", [
80           "comma=%2C,dot=.,semi=%3B",
81           "comma=%2C,semi=%3B,dot=.",
82           "dot=.,comma=%2C,semi=%3B",
83           "dot=.,semi=%3B,comma=%2C",
84           "semi=%3B,comma=%2C,dot=.",
85           "semi=%3B,dot=.,comma=%2C"
86         ]]
87      ]
88   },
89   "3.2.3 Reserved Expansion" :
90   {
91     "variables": {
92        "count"      : ["one", "two", "three"],
93        "dom"        : ["example", "com"],
94        "dub"        : "me/too",
95        "hello"      : "Hello World!",
96        "half"       : "50%",
97        "var"        : "value",
98        "who"        : "fred",
99        "base"       : "http://example.com/home/",
100        "path"       : "/foo/bar",
101        "list"       : ["red", "green", "blue"],
102        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
103        "v"          : "6",
104        "x"          : "1024",
105        "y"          : "768",
106        "empty"      : "",
107        "empty_keys" : [],
108        "undef"      : null
109      },
110      "testcases" : [
111         ["{+var}", "value"],
112         ["{+hello}", "Hello%20World!"],
113         ["{+half}", "50%25"],
114         ["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"],
115         ["{+base}index", "http://example.com/home/index"],
116         ["O{+empty}X", "OX"],
117         ["O{+undef}X", "OX"],
118         ["{+path}/here", "/foo/bar/here"],
119         ["{+path:6}/here", "/foo/b/here"],
120         ["here?ref={+path}", "here?ref=/foo/bar"],
121         ["up{+path}{var}/here", "up/foo/barvalue/here"],
122         ["{+x,hello,y}", "1024,Hello%20World!,768"],
123         ["{+path,x}/here", "/foo/bar,1024/here"],
124         ["{+list}", "red,green,blue"],
125         ["{+list*}", "red,green,blue"],
126         ["{+keys}", [
127           "comma,,,dot,.,semi,;",
128           "comma,,,semi,;,dot,.",
129           "dot,.,comma,,,semi,;",
130           "dot,.,semi,;,comma,,",
131           "semi,;,comma,,,dot,.",
132           "semi,;,dot,.,comma,,"
133         ]],
134         ["{+keys*}", [
135           "comma=,,dot=.,semi=;",
136           "comma=,,semi=;,dot=.",
137           "dot=.,comma=,,semi=;",
138           "dot=.,semi=;,comma=,",
139           "semi=;,comma=,,dot=.",
140           "semi=;,dot=.,comma=,"
141         ]]
142      ]
143   },
144   "3.2.4 Fragment Expansion" :
145   {
146     "variables": {
147        "count"      : ["one", "two", "three"],
148        "dom"        : ["example", "com"],
149        "dub"        : "me/too",
150        "hello"      : "Hello World!",
151        "half"       : "50%",
152        "var"        : "value",
153        "who"        : "fred",
154        "base"       : "http://example.com/home/",
155        "path"       : "/foo/bar",
156        "list"       : ["red", "green", "blue"],
157        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
158        "v"          : "6",
159        "x"          : "1024",
160        "y"          : "768",
161        "empty"      : "",
162        "empty_keys" : [],
163        "undef"      : null
164      },
165      "testcases" : [
166         ["{#var}", "#value"],
167         ["{#hello}", "#Hello%20World!"],
168         ["{#half}", "#50%25"],
169         ["foo{#empty}", "foo#"],
170         ["foo{#undef}", "foo"],
171         ["{#x,hello,y}", "#1024,Hello%20World!,768"],
172         ["{#path,x}/here", "#/foo/bar,1024/here"],
173         ["{#path:6}/here", "#/foo/b/here"],
174         ["{#list}", "#red,green,blue"],
175         ["{#list*}", "#red,green,blue"],
176         ["{#keys}", [
177           "#comma,,,dot,.,semi,;",
178           "#comma,,,semi,;,dot,.",
179           "#dot,.,comma,,,semi,;",
180           "#dot,.,semi,;,comma,,",
181           "#semi,;,comma,,,dot,.",
182           "#semi,;,dot,.,comma,,"
183         ]]
184     ]
185   },
186   "3.2.5 Label Expansion with Dot-Prefix" :
187   {
188     "variables": {
189        "count"      : ["one", "two", "three"],
190        "dom"        : ["example", "com"],
191        "dub"        : "me/too",
192        "hello"      : "Hello World!",
193        "half"       : "50%",
194        "var"        : "value",
195        "who"        : "fred",
196        "base"       : "http://example.com/home/",
197        "path"       : "/foo/bar",
198        "list"       : ["red", "green", "blue"],
199        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
200        "v"          : "6",
201        "x"          : "1024",
202        "y"          : "768",
203        "empty"      : "",
204        "empty_keys" : [],
205        "undef"      : null
206     },
207     "testcases" : [
208        ["{.who}", ".fred"],
209        ["{.who,who}", ".fred.fred"],
210        ["{.half,who}", ".50%25.fred"],
211        ["www{.dom*}", "www.example.com"],
212        ["X{.var}", "X.value"],
213        ["X{.var:3}", "X.val"],
214        ["X{.empty}", "X."],
215        ["X{.undef}", "X"],
216        ["X{.list}", "X.red,green,blue"],
217        ["X{.list*}", "X.red.green.blue"],
218        ["{#keys}", [
219         "#comma,,,dot,.,semi,;",
220         "#comma,,,semi,;,dot,.",
221         "#dot,.,comma,,,semi,;",
222         "#dot,.,semi,;,comma,,",
223         "#semi,;,comma,,,dot,.",
224         "#semi,;,dot,.,comma,,"
225        ]],
226        ["{#keys*}", [
227         "#comma=,,dot=.,semi=;",
228         "#comma=,,semi=;,dot=.",
229         "#dot=.,comma=,,semi=;",
230         "#dot=.,semi=;,comma=,",
231         "#semi=;,comma=,,dot=.",
232         "#semi=;,dot=.,comma=,"
233        ]],
234        ["X{.empty_keys}", "X"],
235        ["X{.empty_keys*}", "X"]
236     ]
237   },
238   "3.2.6 Path Segment Expansion" :
239   {
240     "variables": {
241        "count"      : ["one", "two", "three"],
242        "dom"        : ["example", "com"],
243        "dub"        : "me/too",
244        "hello"      : "Hello World!",
245        "half"       : "50%",
246        "var"        : "value",
247        "who"        : "fred",
248        "base"       : "http://example.com/home/",
249        "path"       : "/foo/bar",
250        "list"       : ["red", "green", "blue"],
251        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
252        "v"          : "6",
253        "x"          : "1024",
254        "y"          : "768",
255        "empty"      : "",
256        "empty_keys" : [],
257        "undef"      : null
258      },
259      "testcases" : [
260        ["{/who}", "/fred"],
261        ["{/who,who}", "/fred/fred"],
262        ["{/half,who}", "/50%25/fred"],
263        ["{/who,dub}", "/fred/me%2Ftoo"],
264        ["{/var}", "/value"],
265        ["{/var,empty}", "/value/"],
266        ["{/var,undef}", "/value"],
267        ["{/var,x}/here", "/value/1024/here"],
268        ["{/var:1,var}", "/v/value"],
269        ["{/list}", "/red,green,blue"],
270        ["{/list*}", "/red/green/blue"],
271        ["{/list*,path:4}", "/red/green/blue/%2Ffoo"],
272        ["{/keys}", [
273         "/comma,%2C,dot,.,semi,%3B",
274         "/comma,%2C,semi,%3B,dot,.",
275         "/dot,.,comma,%2C,semi,%3B",
276         "/dot,.,semi,%3B,comma,%2C",
277         "/semi,%3B,comma,%2C,dot,.",
278         "/semi,%3B,dot,.,comma,%2C"
279        ]],
280        ["{/keys*}", [ 
281         "/comma=%2C/dot=./semi=%3B",
282         "/comma=%2C/semi=%3B/dot=.",
283         "/dot=./comma=%2C/semi=%3B",
284         "/dot=./semi=%3B/comma=%2C",
285         "/semi=%3B/comma=%2C/dot=.",
286         "/semi=%3B/dot=./comma=%2C"
287        ]]
288      ]
289   },
290   "3.2.7 Path-Style Parameter Expansion" :
291   {
292     "variables": {
293        "count"      : ["one", "two", "three"],
294        "dom"        : ["example", "com"],
295        "dub"        : "me/too",
296        "hello"      : "Hello World!",
297        "half"       : "50%",
298        "var"        : "value",
299        "who"        : "fred",
300        "base"       : "http://example.com/home/",
301        "path"       : "/foo/bar",
302        "list"       : ["red", "green", "blue"],
303        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
304        "v"          : "6",
305        "x"          : "1024",
306        "y"          : "768",
307        "empty"      : "",
308        "empty_keys" : [],
309        "undef"      : null
310      },
311      "testcases" : [
312         ["{;who}", ";who=fred"],
313         ["{;half}", ";half=50%25"],
314         ["{;empty}", ";empty"],
315         ["{;hello:5}", ";hello=Hello"],
316         ["{;v,empty,who}", ";v=6;empty;who=fred"],
317         ["{;v,bar,who}", ";v=6;who=fred"],
318         ["{;x,y}", ";x=1024;y=768"],
319         ["{;x,y,empty}", ";x=1024;y=768;empty"],
320         ["{;x,y,undef}", ";x=1024;y=768"],
321         ["{;list}", ";list=red,green,blue"],
322         ["{;list*}", ";list=red;list=green;list=blue"],
323         ["{;keys}", [ 
324           ";keys=comma,%2C,dot,.,semi,%3B",
325           ";keys=comma,%2C,semi,%3B,dot,.",
326           ";keys=dot,.,comma,%2C,semi,%3B",
327           ";keys=dot,.,semi,%3B,comma,%2C",
328           ";keys=semi,%3B,comma,%2C,dot,.",
329           ";keys=semi,%3B,dot,.,comma,%2C"
330         ]],
331         ["{;keys*}", [ 
332           ";comma=%2C;dot=.;semi=%3B",
333           ";comma=%2C;semi=%3B;dot=.",
334           ";dot=.;comma=%2C;semi=%3B",
335           ";dot=.;semi=%3B;comma=%2C",
336           ";semi=%3B;comma=%2C;dot=.",
337           ";semi=%3B;dot=.;comma=%2C"
338         ]]
339      ]
340   },
341   "3.2.8 Form-Style Query Expansion" :
342   {
343     "variables": {
344        "count"      : ["one", "two", "three"],
345        "dom"        : ["example", "com"],
346        "dub"        : "me/too",
347        "hello"      : "Hello World!",
348        "half"       : "50%",
349        "var"        : "value",
350        "who"        : "fred",
351        "base"       : "http://example.com/home/",
352        "path"       : "/foo/bar",
353        "list"       : ["red", "green", "blue"],
354        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
355        "v"          : "6",
356        "x"          : "1024",
357        "y"          : "768",
358        "empty"      : "",
359        "empty_keys" : [],
360        "undef"      : null
361      },
362      "testcases" : [
363         ["{?who}", "?who=fred"],
364         ["{?half}", "?half=50%25"],
365         ["{?x,y}", "?x=1024&y=768"],
366         ["{?x,y,empty}", "?x=1024&y=768&empty="],
367         ["{?x,y,undef}", "?x=1024&y=768"],
368         ["{?var:3}", "?var=val"],
369         ["{?list}", "?list=red,green,blue"],
370         ["{?list*}", "?list=red&list=green&list=blue"],
371         ["{?keys}", [ 
372           "?keys=comma,%2C,dot,.,semi,%3B",
373           "?keys=comma,%2C,semi,%3B,dot,.",
374           "?keys=dot,.,comma,%2C,semi,%3B",
375           "?keys=dot,.,semi,%3B,comma,%2C",
376           "?keys=semi,%3B,comma,%2C,dot,.",
377           "?keys=semi,%3B,dot,.,comma,%2C"
378         ]],
379         ["{?keys*}", [ 
380           "?comma=%2C&dot=.&semi=%3B",
381           "?comma=%2C&semi=%3B&dot=.",
382           "?dot=.&comma=%2C&semi=%3B",
383           "?dot=.&semi=%3B&comma=%2C",
384           "?semi=%3B&comma=%2C&dot=.",
385           "?semi=%3B&dot=.&comma=%2C"
386         ]]
387      ]
388   },
389   "3.2.9 Form-Style Query Continuation" :
390   {
391     "variables": {
392        "count"      : ["one", "two", "three"],
393        "dom"        : ["example", "com"],
394        "dub"        : "me/too",
395        "hello"      : "Hello World!",
396        "half"       : "50%",
397        "var"        : "value",
398        "who"        : "fred",
399        "base"       : "http://example.com/home/",
400        "path"       : "/foo/bar",
401        "list"       : ["red", "green", "blue"],
402        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
403        "v"          : "6",
404        "x"          : "1024",
405        "y"          : "768",
406        "empty"      : "",
407        "empty_keys" : [],
408        "undef"      : null
409      },
410      "testcases" : [
411           ["{&who}", "&who=fred"],
412           ["{&half}", "&half=50%25"],
413           ["?fixed=yes{&x}", "?fixed=yes&x=1024"],
414           ["{&var:3}", "&var=val"],
415           ["{&x,y,empty}", "&x=1024&y=768&empty="],
416           ["{&x,y,undef}", "&x=1024&y=768"],
417           ["{&list}", "&list=red,green,blue"],
418           ["{&list*}", "&list=red&list=green&list=blue"],
419           ["{&keys}", [ 
420             "&keys=comma,%2C,dot,.,semi,%3B",
421             "&keys=comma,%2C,semi,%3B,dot,.",
422             "&keys=dot,.,comma,%2C,semi,%3B",
423             "&keys=dot,.,semi,%3B,comma,%2C",
424             "&keys=semi,%3B,comma,%2C,dot,.",
425             "&keys=semi,%3B,dot,.,comma,%2C"
426           ]],
427           ["{&keys*}", [ 
428             "&comma=%2C&dot=.&semi=%3B",
429             "&comma=%2C&semi=%3B&dot=.",
430             "&dot=.&comma=%2C&semi=%3B",
431             "&dot=.&semi=%3B&comma=%2C",
432             "&semi=%3B&comma=%2C&dot=.",
433             "&semi=%3B&dot=.&comma=%2C"
434           ]]
435      ]
436   }
437 }