PageRenderTime 26ms CodeModel.GetById 10ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/google-toolbox-for-mac/Foundation/TestData/GTMURITemplateExtraTests.json

http://macfuse.googlecode.com/
JSON | 222 lines | 222 code | 0 blank | 0 comment | 0 complexity | 6831c4c6ffb85b08f6bc162ebc220829 MD5 | raw file
  1{
  2  "No varspec (section 3.3, paragraph 3)" :
  3  {
  4    "variables": {
  5       "var"   : "value"
  6     },
  7     "testcases" : [
  8        ["{}", "{}"],
  9        ["{,}", "{,}"],
 10        ["{,,}", "{,,}"]
 11     ]
 12  },
 13  "Missing closing brace (section 3.3 paragraph 4)" :
 14  {
 15    "variables": {
 16       "var"   : "value",
 17       "hello" : "Hello World!",
 18       "list"  : [ "val1", "val2", "val3" ],
 19       "keys"  : {"key1": "val1", "key2": "val2"},
 20       "x"     : "1024",
 21       "y"     : "768"
 22     },
 23     "testcases" : [
 24        ["{var", "value"],
 25        ["{hello", "Hello%20World%21"],
 26        ["{x,y", "1024,768"],
 27        ["{var=default", "value"],
 28        ["{undef=default", "default"],
 29        ["{list", "val1,val2,val3"],
 30        ["{list*", "val1,val2,val3"],
 31        ["{list+", "list.val1,list.val2,list.val3"],
 32        ["{keys", "key1,val1,key2,val2"],
 33        ["{keys*", "key1,val1,key2,val2"],
 34        ["{keys+", "keys.key1,val1,keys.key2,val2"]
 35     ]
 36  },
 37  "varspec of only operator and explodes (section 3.3?)" :
 38  {
 39    "variables": {
 40       "var"   : "value"
 41     },
 42     "testcases" : [
 43        ["{+}", "{+}"],
 44        ["{;}", "{;}"],
 45        ["{?}", "{?}"],
 46        ["{/}", "{/}"],
 47        ["{.}", "{.}"],
 48        ["{+,}", "{+,}"],
 49        ["{;,}", "{;,}"],
 50        ["{?,}", "{?,}"],
 51        ["{/,}", "{/,}"],
 52        ["{.,}", "{.,}"],
 53        ["{++}", "{++}"],
 54        ["{;+}", "{;+}"],
 55        ["{?+}", "{?+}"],
 56        ["{/+}", "{/+}"],
 57        ["{.+}", "{.+}"],
 58        ["{+*}", "{+*}"],
 59        ["{;*}", "{;*}"],
 60        ["{?*}", "{?*}"],
 61        ["{/*}", "{/*}"],
 62        ["{.*}", "{.*}"]
 63     ]
 64  },
 65  "One good varspec and bad varspecs (section 3.3, paragraph 3?)" :
 66  {
 67    "variables": {
 68       "var"   : "value"
 69     },
 70     "testcases" : [
 71        ["{var,}", "value"],
 72        ["{,var}", "value"],
 73        ["{,var,,}", "value"],
 74        ["{+var,,}", "value"],
 75        ["{;var,,}", ";var=value"],
 76        ["{?var,,}", "?var=value"],
 77        ["{/var,,}", "/value"],
 78        ["{.var,,}", ".value"],
 79        ["{+,var,}", "value"],
 80        ["{;,var,}", ";var=value"],
 81        ["{?,var,}", "?var=value"],
 82        ["{/,var,}", "/value"],
 83        ["{.,var,}", ".value"],
 84        ["{+,,var}", "value"],
 85        ["{;,,var}", ";var=value"],
 86        ["{?,,var}", "?var=value"],
 87        ["{/,,var}", "/value"],
 88        ["{.,,var}", ".value"]
 89     ]
 90  },
 91  "Multiple undefined variables (section 3.4)" :
 92  {
 93    "variables": {
 94       "var"   : "value"
 95     },
 96     "testcases" : [
 97        ["{undef1,undef2}", ""],
 98        ["{+undef1,undef2}", ""],
 99        ["{;undef1,undef2}", ""],
100        ["{?undef1,undef2}", ""],
101        ["{/undef1,undef2}", ""],
102        ["{.undef1,undef2}", ""]
103     ]
104  },
105  "Default with variable in varspec (just reported like above cases)" :
106  {
107    "variables": {
108       "var"   : "value"
109     },
110     "testcases" : [
111        ["{=foo}", "{=foo}"]
112     ]
113  },
114  "varspec with bad partial (partial gets ignored)" :
115  {
116    "variables": {
117       "var"   : "value"
118     },
119     "testcases" : [
120        ["{var:}", "value"],
121        ["{var^}", "value"]
122     ]
123  },
124  "Default of empty string and edge cases with empty strings" :
125  {
126    "variables": {
127       "empty" : "",
128       "x"     : "1024",
129       "y"     : "768"
130     },
131     "testcases" : [
132        ["{empty}", ""],
133        ["{;x,empty,y}", ";x=1024;empty;y=768"],
134        ["{?x,empty,y}", "?x=1024&empty&y=768"],
135        ["{x,empty,y}", "1024,,768"],
136        ["{+x,empty,y}", "1024,,768"],
137        ["{/x,empty,y}", "/1024//768"],
138        ["{.x,empty,y}", ".1024..768"],
139        ["{undef=}", ""],
140        ["{;x,undef=,y}", ";x=1024;undef;y=768"],
141        ["{?x,undef=,y}", "?x=1024&undef&y=768"],
142        ["{x,undef=,y}", "1024,,768"],
143        ["{+x,undef=,y}", "1024,,768"],
144        ["{/x,undef=,y}", "/1024//768"],
145        ["{.x,undef=,y}", ".1024..768"]
146     ]
147  },
148  "Two defaults for one variable" :
149  {
150    "variables": {
151       "y"     : "768"
152     },
153     "testcases" : [
154        ["1{undef=a}2{undef=b}3", "1a2b3"],
155        ["0{undef}1{undef=a}2{undef}3{undef=b}4{undef}5", "01a2a3b4b5"]
156     ]
157  },
158  "Empty strings within arrays and associative arrays" :
159  {
160    "variables": {
161       "list"  : [ "val1", "", "val3" ],
162       "keysA"  : {"key1": "", "key2": "val2"},
163       "keysB"  : {"key1": "val1", "": "val2"}
164     },
165     "testcases" : [
166        ["{list}", "val1,,val3"],
167        ["{list*}", "val1,,val3"],
168        ["{list+}", "list.val1,list.,list.val3"],
169        ["{keysA}", "key1,,key2,val2"],
170        ["{keysA*}", "key1,,key2,val2"],
171        ["{keysA+}", "keysA.key1,,keysA.key2,val2"],
172        ["{keysB}", ",val2,key1,val1"],
173        ["{keysB*}", ",val2,key1,val1"],
174        ["{keysB+}", "keysB.,val2,keysB.key1,val1"],
175        ["{+list}", "val1,,val3"],
176        ["{+list*}", "val1,,val3"],
177        ["{+list+}", "list.val1,list.,list.val3"],
178        ["{+keysA}", "key1,,key2,val2"],
179        ["{+keysA*}", "key1,,key2,val2"],
180        ["{+keysA+}", "keysA.key1,,keysA.key2,val2"],
181        ["{+keysB}", ",val2,key1,val1"],
182        ["{+keysB*}", ",val2,key1,val1"],
183        ["{+keysB+}", "keysB.,val2,keysB.key1,val1"],
184        ["{;list}", ";val1,,val3"],
185        ["{;list*}", ";val1;;val3"],
186        ["{;list+}", ";list=val1;list=;list=val3"],
187        ["{;keysA}", ";key1,key2,val2"],
188        ["{;keysA*}", ";key1;key2=val2"],
189        ["{;keysA+}", ";keysA.key1;keysA.key2=val2"],
190        ["{;keysB}", ";,val2,key1,val1"],
191        ["{;keysB*}", ";=val2;key1=val1"],
192        ["{;keysB+}", ";keysB.=val2;keysB.key1=val1"],
193        ["{?list}", "?list=val1,,val3"],
194        ["{?list*}", "?val1&&val3"],
195        ["{?list+}", "?list=val1&list=&list=val3"],
196        ["{?keysA}", "?keysA=key1,key2,val2"],
197        ["{?keysA*}", "?key1&key2=val2"],
198        ["{?keysA+}", "?keysA.key1&keysA.key2=val2"],
199        ["{?keysB}", "?keysB=,val2,key1,val1"],
200        ["{?keysB*}", "?=val2&key1=val1"],
201        ["{?keysB+}", "?keysB.=val2&keysB.key1=val1"],
202        ["{/list}", "/val1,,val3"],
203        ["{/list*}", "/val1//val3"],
204        ["{/list+}", "/list.val1/list./list.val3"],
205        ["{/keysA}", "/key1,,key2,val2"],
206        ["{/keysA*}", "/key1//key2/val2"],
207        ["{/keysA+}", "/keysA.key1//keysA.key2/val2"],
208        ["{/keysB}", "/,val2,key1,val1"],
209        ["{/keysB*}", "//val2/key1/val1"],
210        ["{/keysB+}", "/keysB./val2/keysB.key1/val1"],
211        ["X{.list}", "X.val1,,val3"],
212        ["X{.list*}", "X.val1..val3"],
213        ["X{.list+}", "X.list.val1.list..list.val3"],
214        ["X{.keysA}", "X.key1,,key2,val2"],
215        ["X{.keysA*}", "X.key1..key2.val2"],
216        ["X{.keysA+}", "X.keysA.key1..keysA.key2.val2"],
217        ["X{.keysB}", "X.,val2,key1,val1"],
218        ["X{.keysB*}", "X..val2.key1.val1"],
219        ["X{.keysB+}", "X.keysB..val2.keysB.key1.val1"]
220     ]
221  }
222}