@@ -149,6 +149,49 @@ Deno.test("format encodes '#' in 'params'", () => {
149
149
const exp = "denops:///absolute/path/to/worktree;foo=%23foo" ;
150
150
assertEquals ( dst , exp ) ;
151
151
} ) ;
152
+ Deno . test ( "format pass example in README.md" , ( ) => {
153
+ assertEquals (
154
+ format ( {
155
+ scheme : "denops" ,
156
+ expr : "/Users/John Titor/test.git" ,
157
+ } ) ,
158
+ "denops:///Users/John Titor/test.git" ,
159
+ ) ;
160
+
161
+ assertEquals (
162
+ format ( {
163
+ scheme : "denops" ,
164
+ expr : "/Users/John Titor/test.git" ,
165
+ params : {
166
+ foo : "foo" ,
167
+ bar : [ "bar1" , "bar2" ] ,
168
+ } ,
169
+ } ) ,
170
+ "denops:///Users/John Titor/test.git;foo=foo&bar=bar1&bar=bar2" ,
171
+ ) ;
172
+
173
+ assertEquals (
174
+ format ( {
175
+ scheme : "denops" ,
176
+ expr : "/Users/John Titor/test.git" ,
177
+ fragment : "README.md" ,
178
+ } ) ,
179
+ "denops:///Users/John Titor/test.git#README.md" ,
180
+ ) ;
181
+
182
+ assertEquals (
183
+ format ( {
184
+ scheme : "denops" ,
185
+ expr : "/Users/John Titor/test.git" ,
186
+ params : {
187
+ foo : "foo" ,
188
+ bar : [ "bar1" , "bar2" ] ,
189
+ } ,
190
+ fragment : "README.md" ,
191
+ } ) ,
192
+ "denops:///Users/John Titor/test.git;foo=foo&bar=bar1&bar=bar2#README.md" ,
193
+ ) ;
194
+ } ) ;
152
195
153
196
Deno . test ( "parse throws exception when 'expr' contains unusable characters" , ( ) => {
154
197
const src = "denops:///<>|?*" ;
@@ -286,3 +329,48 @@ Deno.test("parse decode percent-encoded characters ('#') in 'params'", () => {
286
329
} ;
287
330
assertEquals ( dst , exp ) ;
288
331
} ) ;
332
+ Deno . test ( "parse pass example in README.md" , ( ) => {
333
+ assertEquals (
334
+ parse ( "denops:///Users/John Titor/test.git" ) ,
335
+ {
336
+ scheme : "denops" ,
337
+ expr : "/Users/John Titor/test.git" ,
338
+ } ,
339
+ ) ;
340
+
341
+ assertEquals (
342
+ parse ( "denops:///Users/John Titor/test.git;foo=foo&bar=bar1&bar=bar2" ) ,
343
+ {
344
+ scheme : "denops" ,
345
+ expr : "/Users/John Titor/test.git" ,
346
+ params : {
347
+ foo : "foo" ,
348
+ bar : [ "bar1" , "bar2" ] ,
349
+ } ,
350
+ } ,
351
+ ) ;
352
+
353
+ assertEquals (
354
+ parse ( "denops:///Users/John Titor/test.git#README.md" ) ,
355
+ {
356
+ scheme : "denops" ,
357
+ expr : "/Users/John Titor/test.git" ,
358
+ fragment : "README.md" ,
359
+ } ,
360
+ ) ;
361
+
362
+ assertEquals (
363
+ parse (
364
+ "denops:///Users/John Titor/test.git;foo=foo&bar=bar1&bar=bar2#README.md" ,
365
+ ) ,
366
+ {
367
+ scheme : "denops" ,
368
+ expr : "/Users/John Titor/test.git" ,
369
+ params : {
370
+ foo : "foo" ,
371
+ bar : [ "bar1" , "bar2" ] ,
372
+ } ,
373
+ fragment : "README.md" ,
374
+ } ,
375
+ ) ;
376
+ } ) ;
0 commit comments