Imported Upstream version 0.18
[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         ["{/var,empty}", "/value/"],
113         ["{/var,undef}", "/value"],
114         ["{+hello}", "Hello%20World!"],
115         ["{+half}", "50%25"],
116         ["{base}index", "http%3A%2F%2Fexample.com%2Fhome%2Findex"],
117         ["{+base}index", "http://example.com/home/index"],
118         ["O{+empty}X", "OX"],
119         ["O{+undef}X", "OX"],
120         ["{+path}/here", "/foo/bar/here"],
121         ["{+path:6}/here", "/foo/b/here"],
122         ["here?ref={+path}", "here?ref=/foo/bar"],
123         ["up{+path}{var}/here", "up/foo/barvalue/here"],
124         ["{+x,hello,y}", "1024,Hello%20World!,768"],
125         ["{+path,x}/here", "/foo/bar,1024/here"],
126         ["{+list}", "red,green,blue"],
127         ["{+list*}", "red,green,blue"],
128         ["{+keys}", [
129           "comma,,,dot,.,semi,;",
130           "comma,,,semi,;,dot,.",
131           "dot,.,comma,,,semi,;",
132           "dot,.,semi,;,comma,,",
133           "semi,;,comma,,,dot,.",
134           "semi,;,dot,.,comma,,"
135         ]],
136         ["{+keys*}", [
137           "comma=,,dot=.,semi=;",
138           "comma=,,semi=;,dot=.",
139           "dot=.,comma=,,semi=;",
140           "dot=.,semi=;,comma=,",
141           "semi=;,comma=,,dot=.",
142           "semi=;,dot=.,comma=,"
143         ]]
144      ]
145   },
146   "3.2.4 Fragment Expansion" :
147   {
148     "variables": {
149        "count"      : ["one", "two", "three"],
150        "dom"        : ["example", "com"],
151        "dub"        : "me/too",
152        "hello"      : "Hello World!",
153        "half"       : "50%",
154        "var"        : "value",
155        "who"        : "fred",
156        "base"       : "http://example.com/home/",
157        "path"       : "/foo/bar",
158        "list"       : ["red", "green", "blue"],
159        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
160        "v"          : "6",
161        "x"          : "1024",
162        "y"          : "768",
163        "empty"      : "",
164        "empty_keys" : [],
165        "undef"      : null
166      },
167      "testcases" : [
168         ["{#var}", "#value"],
169         ["{#hello}", "#Hello%20World!"],
170         ["{#half}", "#50%25"],
171         ["foo{#empty}", "foo#"],
172         ["foo{#undef}", "foo"],
173         ["{#x,hello,y}", "#1024,Hello%20World!,768"],
174         ["{#path,x}/here", "#/foo/bar,1024/here"],
175         ["{#path:6}/here", "#/foo/b/here"],
176         ["{#list}", "#red,green,blue"],
177         ["{#list*}", "#red,green,blue"],
178         ["{#keys}", [
179           "#comma,,,dot,.,semi,;",
180           "#comma,,,semi,;,dot,.",
181           "#dot,.,comma,,,semi,;",
182           "#dot,.,semi,;,comma,,",
183           "#semi,;,comma,,,dot,.",
184           "#semi,;,dot,.,comma,,"
185         ]]
186     ]
187   },
188   "3.2.5 Label Expansion with Dot-Prefix" :
189   {
190     "variables": {
191        "count"      : ["one", "two", "three"],
192        "dom"        : ["example", "com"],
193        "dub"        : "me/too",
194        "hello"      : "Hello World!",
195        "half"       : "50%",
196        "var"        : "value",
197        "who"        : "fred",
198        "base"       : "http://example.com/home/",
199        "path"       : "/foo/bar",
200        "list"       : ["red", "green", "blue"],
201        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
202        "v"          : "6",
203        "x"          : "1024",
204        "y"          : "768",
205        "empty"      : "",
206        "empty_keys" : [],
207        "undef"      : null
208     },
209     "testcases" : [
210        ["{.who}", ".fred"],
211        ["{.who,who}", ".fred.fred"],
212        ["{.half,who}", ".50%25.fred"],
213        ["www{.dom*}", "www.example.com"],
214        ["X{.var}", "X.value"],
215        ["X{.var:3}", "X.val"],
216        ["X{.empty}", "X."],
217        ["X{.undef}", "X"],
218        ["X{.list}", "X.red,green,blue"],
219        ["X{.list*}", "X.red.green.blue"],
220        ["{#keys}", [
221         "#comma,,,dot,.,semi,;",
222         "#comma,,,semi,;,dot,.",
223         "#dot,.,comma,,,semi,;",
224         "#dot,.,semi,;,comma,,",
225         "#semi,;,comma,,,dot,.",
226         "#semi,;,dot,.,comma,,"
227        ]],
228        ["{#keys*}", [
229         "#comma=,,dot=.,semi=;",
230         "#comma=,,semi=;,dot=.",
231         "#dot=.,comma=,,semi=;",
232         "#dot=.,semi=;,comma=,",
233         "#semi=;,comma=,,dot=.",
234         "#semi=;,dot=.,comma=,"
235        ]],
236        ["X{.empty_keys}", "X"],
237        ["X{.empty_keys*}", "X"]
238     ]
239   },
240   "3.2.6 Path Segment Expansion" :
241   {
242     "variables": {
243        "count"      : ["one", "two", "three"],
244        "dom"        : ["example", "com"],
245        "dub"        : "me/too",
246        "hello"      : "Hello World!",
247        "half"       : "50%",
248        "var"        : "value",
249        "who"        : "fred",
250        "base"       : "http://example.com/home/",
251        "path"       : "/foo/bar",
252        "list"       : ["red", "green", "blue"],
253        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
254        "v"          : "6",
255        "x"          : "1024",
256        "y"          : "768",
257        "empty"      : "",
258        "empty_keys" : [],
259        "undef"      : null
260      },
261      "testcases" : [
262        ["{/who}", "/fred"],
263        ["{/who,who}", "/fred/fred"],
264        ["{/half,who}", "/50%25/fred"],
265        ["{/who,dub}", "/fred/me%2Ftoo"],
266        ["{/var}", "/value"],
267        ["{/var,empty}", "/value/"],
268        ["{/var,undef}", "/value"],
269        ["{/var,x}/here", "/value/1024/here"],
270        ["{/var:1,var}", "/v/value"],
271        ["{/list}", "/red,green,blue"],
272        ["{/list*}", "/red/green/blue"],
273        ["{/list*,path:4}", "/red/green/blue/%2Ffoo"],
274        ["{/keys}", [
275         "/comma,%2C,dot,.,semi,%3B",
276         "/comma,%2C,semi,%3B,dot,.",
277         "/dot,.,comma,%2C,semi,%3B",
278         "/dot,.,semi,%3B,comma,%2C",
279         "/semi,%3B,comma,%2C,dot,.",
280         "/semi,%3B,dot,.,comma,%2C"
281        ]],
282        ["{/keys*}", [ 
283         "/comma=%2C/dot=./semi=%3B",
284         "/comma=%2C/semi=%3B/dot=.",
285         "/dot=./comma=%2C/semi=%3B",
286         "/dot=./semi=%3B/comma=%2C",
287         "/semi=%3B/comma=%2C/dot=.",
288         "/semi=%3B/dot=./comma=%2C"
289        ]]
290      ]
291   },
292   "3.2.7 Path-Style Parameter Expansion" :
293   {
294     "variables": {
295        "count"      : ["one", "two", "three"],
296        "dom"        : ["example", "com"],
297        "dub"        : "me/too",
298        "hello"      : "Hello World!",
299        "half"       : "50%",
300        "var"        : "value",
301        "who"        : "fred",
302        "base"       : "http://example.com/home/",
303        "path"       : "/foo/bar",
304        "list"       : ["red", "green", "blue"],
305        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
306        "v"          : "6",
307        "x"          : "1024",
308        "y"          : "768",
309        "empty"      : "",
310        "empty_keys" : [],
311        "undef"      : null
312      },
313      "testcases" : [
314         ["{;who}", ";who=fred"],
315         ["{;half}", ";half=50%25"],
316         ["{;empty}", ";empty"],
317         ["{;hello:5}", ";hello=Hello"],
318         ["{;v,empty,who}", ";v=6;empty;who=fred"],
319         ["{;v,bar,who}", ";v=6;who=fred"],
320         ["{;x,y}", ";x=1024;y=768"],
321         ["{;x,y,empty}", ";x=1024;y=768;empty"],
322         ["{;x,y,undef}", ";x=1024;y=768"],
323         ["{;list}", ";list=red,green,blue"],
324         ["{;list*}", ";list=red;list=green;list=blue"],
325         ["{;keys}", [ 
326           ";keys=comma,%2C,dot,.,semi,%3B",
327           ";keys=comma,%2C,semi,%3B,dot,.",
328           ";keys=dot,.,comma,%2C,semi,%3B",
329           ";keys=dot,.,semi,%3B,comma,%2C",
330           ";keys=semi,%3B,comma,%2C,dot,.",
331           ";keys=semi,%3B,dot,.,comma,%2C"
332         ]],
333         ["{;keys*}", [ 
334           ";comma=%2C;dot=.;semi=%3B",
335           ";comma=%2C;semi=%3B;dot=.",
336           ";dot=.;comma=%2C;semi=%3B",
337           ";dot=.;semi=%3B;comma=%2C",
338           ";semi=%3B;comma=%2C;dot=.",
339           ";semi=%3B;dot=.;comma=%2C"
340         ]]
341      ]
342   },
343   "3.2.8 Form-Style Query Expansion" :
344   {
345     "variables": {
346        "count"      : ["one", "two", "three"],
347        "dom"        : ["example", "com"],
348        "dub"        : "me/too",
349        "hello"      : "Hello World!",
350        "half"       : "50%",
351        "var"        : "value",
352        "who"        : "fred",
353        "base"       : "http://example.com/home/",
354        "path"       : "/foo/bar",
355        "list"       : ["red", "green", "blue"],
356        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
357        "v"          : "6",
358        "x"          : "1024",
359        "y"          : "768",
360        "empty"      : "",
361        "empty_keys" : [],
362        "undef"      : null
363      },
364      "testcases" : [
365         ["{?who}", "?who=fred"],
366         ["{?half}", "?half=50%25"],
367         ["{?x,y}", "?x=1024&y=768"],
368         ["{?x,y,empty}", "?x=1024&y=768&empty="],
369         ["{?x,y,undef}", "?x=1024&y=768"],
370         ["{?var:3}", "?var=val"],
371         ["{?list}", "?list=red,green,blue"],
372         ["{?list*}", "?list=red&list=green&list=blue"],
373         ["{?keys}", [ 
374           "?keys=comma,%2C,dot,.,semi,%3B",
375           "?keys=comma,%2C,semi,%3B,dot,.",
376           "?keys=dot,.,comma,%2C,semi,%3B",
377           "?keys=dot,.,semi,%3B,comma,%2C",
378           "?keys=semi,%3B,comma,%2C,dot,.",
379           "?keys=semi,%3B,dot,.,comma,%2C"
380         ]],
381         ["{?keys*}", [ 
382           "?comma=%2C&dot=.&semi=%3B",
383           "?comma=%2C&semi=%3B&dot=.",
384           "?dot=.&comma=%2C&semi=%3B",
385           "?dot=.&semi=%3B&comma=%2C",
386           "?semi=%3B&comma=%2C&dot=.",
387           "?semi=%3B&dot=.&comma=%2C"
388         ]]
389      ]
390   },
391   "3.2.9 Form-Style Query Continuation" :
392   {
393     "variables": {
394        "count"      : ["one", "two", "three"],
395        "dom"        : ["example", "com"],
396        "dub"        : "me/too",
397        "hello"      : "Hello World!",
398        "half"       : "50%",
399        "var"        : "value",
400        "who"        : "fred",
401        "base"       : "http://example.com/home/",
402        "path"       : "/foo/bar",
403        "list"       : ["red", "green", "blue"],
404        "keys"       : { "semi" : ";", "dot" : ".", "comma" : ","},
405        "v"          : "6",
406        "x"          : "1024",
407        "y"          : "768",
408        "empty"      : "",
409        "empty_keys" : [],
410        "undef"      : null
411      },
412      "testcases" : [
413           ["{&who}", "&who=fred"],
414           ["{&half}", "&half=50%25"],
415           ["?fixed=yes{&x}", "?fixed=yes&x=1024"],
416           ["{&var:3}", "&var=val"],
417           ["{&x,y,empty}", "&x=1024&y=768&empty="],
418           ["{&x,y,undef}", "&x=1024&y=768"],
419           ["{&list}", "&list=red,green,blue"],
420           ["{&list*}", "&list=red&list=green&list=blue"],
421           ["{&keys}", [ 
422             "&keys=comma,%2C,dot,.,semi,%3B",
423             "&keys=comma,%2C,semi,%3B,dot,.",
424             "&keys=dot,.,comma,%2C,semi,%3B",
425             "&keys=dot,.,semi,%3B,comma,%2C",
426             "&keys=semi,%3B,comma,%2C,dot,.",
427             "&keys=semi,%3B,dot,.,comma,%2C"
428           ]],
429           ["{&keys*}", [ 
430             "&comma=%2C&dot=.&semi=%3B",
431             "&comma=%2C&semi=%3B&dot=.",
432             "&dot=.&comma=%2C&semi=%3B",
433             "&dot=.&semi=%3B&comma=%2C",
434             "&semi=%3B&comma=%2C&dot=.",
435             "&semi=%3B&dot=.&comma=%2C"
436           ]]
437      ]
438   }
439 }