ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / base / test / common / uriTemplate.test.ts 502 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
import { ensureNoDisposablesAreLeakedInTestSuite } from './utils.js' ;
import { UriTemplate } from '../../common/uriTemplate.js' ;
import * as assert from 'assert' ;
suite ( 'UriTemplate' , ( ) => {
ensureNoDisposablesAreLeakedInTestSuite ( ) ;
function testParsing ( template: string , expectedComponents: unknown [ ] ) {
const templ = UriTemplate. parse template
assert templ components c c expectedComponents
templ
template variables Record expected
templ UriTemplate template
result templ variables
assert result expected
templ UriTemplate
assert templ components
expression
operator
variables explodable name optional prefixLength repeatable
result templ
assert result
expression
operator
variables explodable name optional prefixLength repeatable
expression
operator
variables explodable name optional prefixLength repeatable
expression
operator
variables
explodable name optional prefixLength repeatable
explodable name optional prefixLength repeatable
expression
operator
variables explodable name optional prefixLength repeatable
expression
operator
variables explodable name optional prefixLength repeatable
expression
operator
variables explodable name optional prefixLength repeatable
expression
operator
variables explodable name optional prefixLength repeatable
variables
hello
variables
variables
x
x
x
variables
hello
path
variables
variables
variables
variables
variables
hello
variables
variables
variables
hello
empty
path
x
y
variables
variables
variables
hello
path
x
y
variables
variables
variables
hello
path
x
y
variables
variables
variables
x
y
variables
variables
variables
x
variables
variables
variables
x
y
empty
variables
variables
variables
x
y
empty
variables
variables
variables
x
y
empty
variables
variables
variables
hello
path
list
keys
semi
dot
comma
variables
variables
variables
variables
variables
hello
path
list
keys
semi
dot
comma
variables
variables
variables
variables
variables
variables
hello
path
list
keys
semi
dot
comma
variables
variables
variables
variables
variables
variables
list
keys
semi
dot
comma
variables
variables
variables
variables
variables
variables
list
path
keys
semi
dot
comma
variables
variables
variables
variables
variables
variables
variables
list
keys
semi
dot
comma
hello
variables
variables
variables
variables
variables
list
keys
semi
dot
comma
variables
variables
variables
variables
variables
variables
list
keys
semi
dot
comma
variables
variables
variables
variables
variables
variables
defined
undef
empty
variables
variables
variables
variables
variables
variables
variables
variables
variables
domain
user
path
query
page
lang
sessionId
filters
coordinates lat lon
variables
variables
variables
expression
operator
variables explodable name optional prefixLength repeatable
expression
operator
variables explodable name optional prefixLength repeatable
a b c
(
)
;
.
deepStrictEqual
(
.
.
filter
(
=>
typeof
===
'object'
)
,
)
;
return
;
}
function
testResolution
(
:
string
,
:
<
string
,
any
>
,
:
string
)
{
const
=
.
parse
(
)
;
const
=
.
resolve
(
)
;
.
strictEqual
(
,
)
;
}
test
(
'simple replacement'
,
(
)
=>
{
const
=
.
parse
(
'http://example.com/{var}'
)
;
.
deepStrictEqual
(
.
,
[
'http://example.com/'
,
{
:
'{var}'
,
:
''
,
:
[
{
:
false
,
:
'var'
,
:
false
,
:
undefined
,
:
false
}
]
}
,
''
]
)
;
const
=
.
resolve
(
{
var
:
'value'
}
)
;
.
strictEqual
(
,
'http://example.com/value'
)
;
}
)
;
test
(
'parsing components correctly'
,
(
)
=>
{
testParsing
(
'http://example.com/{var}'
,
[
{
:
'{var}'
,
:
''
,
:
[
{
:
false
,
:
'var'
,
:
false
,
:
undefined
,
:
false
}
]
}
]
)
;
testParsing
(
'http://example.com/{+path}'
,
[
{
:
'{+path}'
,
:
'+'
,
:
[
{
:
false
,
:
'path'
,
:
false
,
:
undefined
,
:
false
}
]
}
]
)
;
testParsing
(
'http://example.com/{x,y}'
,
[
{
:
'{x,y}'
,
:
''
,
:
[
{
:
false
,
:
'x'
,
:
false
,
:
undefined
,
:
false
}
,
{
:
false
,
:
'y'
,
:
false
,
:
undefined
,
:
false
}
]
}
]
)
;
testParsing
(
'http://example.com/{var:3}'
,
[
{
:
'{var:3}'
,
:
''
,
:
[
{
:
false
,
:
'var'
,
:
false
,
:
3
,
:
false
}
]
}
]
)
;
testParsing
(
'http://example.com/{list*}'
,
[
{
:
'{list*}'
,
:
''
,
:
[
{
:
true
,
:
'list'
,
:
false
,
:
undefined
,
:
true
}
]
}
]
)
;
testParsing
(
'http://example.com/{x}/path/{y}'
,
[
{
:
'{x}'
,
:
''
,
:
[
{
:
false
,
:
'x'
,
:
false
,
:
undefined
,
:
false
}
]
}
,
{
:
'{y}'
,
:
''
,
:
[
{
:
false
,
:
'y'
,
:
false
,
:
undefined
,
:
false
}
]
}
]
)
;
}
)
;
test
(
'Level 1 - Simple string expansion'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
}
;
testResolution
(
'{var}'
,
,
'value'
)
;
testResolution
(
'{hello}'
,
,
'Hello%20World%21'
)
;
}
)
;
test
(
'control characters are percent-encoded with two hex digits'
,
(
)
=>
{
testResolution
(
'{x}'
,
{
:
'a\tb'
}
,
'a%09b'
)
;
testResolution
(
'{x}'
,
{
:
'\n'
}
,
'%0A'
)
;
testResolution
(
'{x}'
,
{
:
'\r'
}
,
'%0D'
)
;
}
)
;
test
(
'Level 2 - Reserved expansion'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
,
:
'/foo/bar'
}
;
testResolution
(
'{+var}'
,
,
'value'
)
;
testResolution
(
'{+hello}'
,
,
'Hello%20World!'
)
;
testResolution
(
'{+path}/here'
,
,
'/foo/bar/here'
)
;
testResolution
(
'here?ref={+path}'
,
,
'here?ref=/foo/bar'
)
;
}
)
;
test
(
'Level 2 - Fragment expansion'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
}
;
testResolution
(
'X{#var}'
,
,
'X#value'
)
;
testResolution
(
'X{#hello}'
,
,
'X#Hello%20World!'
)
;
}
)
;
test
(
'Level 3 - String expansion with multiple variables'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
,
:
''
,
:
'/foo/bar'
,
:
'1024'
,
:
'768'
}
;
testResolution
(
'map?{x,y}'
,
,
'map?1024,768'
)
;
testResolution
(
'{x,hello,y}'
,
,
'1024,Hello%20World%21,768'
)
;
}
)
;
test
(
'Level 3 - Reserved expansion with multiple variables'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
,
:
'/foo/bar'
,
:
'1024'
,
:
'768'
}
;
testResolution
(
'{+x,hello,y}'
,
,
'1024,Hello%20World!,768'
)
;
testResolution
(
'{+path,x}/here'
,
,
'/foo/bar,1024/here'
)
;
}
)
;
test
(
'Level 3 - Fragment expansion with multiple variables'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
,
:
'/foo/bar'
,
:
'1024'
,
:
'768'
}
;
testResolution
(
'{#x,hello,y}'
,
,
'#1024,Hello%20World!,768'
)
;
testResolution
(
'{#path,x}/here'
,
,
'#/foo/bar,1024/here'
)
;
}
)
;
test
(
'Level 3 - Label expansion with dot-prefix'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'1024'
,
:
'768'
}
;
testResolution
(
'X{.var}'
,
,
'X.value'
)
;
testResolution
(
'X{.x,y}'
,
,
'X.1024.768'
)
;
}
)
;
test
(
'Level 3 - Path segments expansion'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'1024'
}
;
testResolution
(
'{/var}'
,
,
'/value'
)
;
testResolution
(
'{/var,x}/here'
,
,
'/value/1024/here'
)
;
}
)
;
test
(
'Level 3 - Path-style parameter expansion'
,
(
)
=>
{
const
=
{
:
'1024'
,
:
'768'
,
:
''
}
;
testResolution
(
'{;x,y}'
,
,
';x=1024;y=768'
)
;
testResolution
(
'{;x,y,empty}'
,
,
';x=1024;y=768;empty'
)
;
}
)
;
test
(
'Level 3 - Form-style query expansion'
,
(
)
=>
{
const
=
{
:
'1024'
,
:
'768'
,
:
''
}
;
testResolution
(
'{?x,y}'
,
,
'?x=1024&y=768'
)
;
testResolution
(
'{?x,y,empty}'
,
,
'?x=1024&y=768&empty='
)
;
}
)
;
test
(
'Level 3 - Form-style query continuation'
,
(
)
=>
{
const
=
{
:
'1024'
,
:
'768'
,
:
''
}
;
testResolution
(
'?fixed=yes{&x}'
,
,
'?fixed=yes&x=1024'
)
;
testResolution
(
'{&x,y,empty}'
,
,
'&x=1024&y=768&empty='
)
;
}
)
;
test
(
'Level 4 - String expansion with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
,
:
'/foo/bar'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'{var:3}'
,
,
'val'
)
;
testResolution
(
'{var:30}'
,
,
'value'
)
;
testResolution
(
'{list}'
,
,
'red,green,blue'
)
;
testResolution
(
'{list*}'
,
,
'red,green,blue'
)
;
}
)
;
test
(
'Level 4 - Reserved expansion with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
,
:
'/foo/bar'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'{+path:6}/here'
,
,
'/foo/b/here'
)
;
testResolution
(
'{+list}'
,
,
'red,green,blue'
)
;
testResolution
(
'{+list*}'
,
,
'red,green,blue'
)
;
testResolution
(
'{+keys}'
,
,
'semi,;,dot,.,comma,,'
)
;
testResolution
(
'{+keys*}'
,
,
'semi=;,dot=.,comma=,'
)
;
}
)
;
test
(
'Level 4 - Fragment expansion with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
'Hello World!'
,
:
'/foo/bar'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'{#path:6}/here'
,
,
'#/foo/b/here'
)
;
testResolution
(
'{#list}'
,
,
'#red,green,blue'
)
;
testResolution
(
'{#list*}'
,
,
'#red,green,blue'
)
;
testResolution
(
'{#keys}'
,
,
'#semi,;,dot,.,comma,,'
)
;
testResolution
(
'{#keys*}'
,
,
'#semi=;,dot=.,comma=,'
)
;
}
)
;
test
(
'Level 4 - Label expansion with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'X{.var:3}'
,
,
'X.val'
)
;
testResolution
(
'X{.list}'
,
,
'X.red,green,blue'
)
;
testResolution
(
'X{.list*}'
,
,
'X.red.green.blue'
)
;
testResolution
(
'X{.keys}'
,
,
'X.semi,;,dot,.,comma,,'
)
;
testResolution
(
'X{.keys*}'
,
,
'X.semi=;.dot=..comma=,'
)
;
}
)
;
test
(
'Level 4 - Path expansion with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
'/foo/bar'
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'{/var:1,var}'
,
,
'/v/value'
)
;
testResolution
(
'{/list}'
,
,
'/red,green,blue'
)
;
testResolution
(
'{/list*}'
,
,
'/red/green/blue'
)
;
testResolution
(
'{/list*,path:4}'
,
,
'/red/green/blue/%2Ffoo'
)
;
testResolution
(
'{/keys}'
,
,
'/semi,;,dot,.,comma,,'
)
;
testResolution
(
'{/keys*}'
,
,
'/semi=%3B/dot=./comma=%2C'
)
;
}
)
;
test
(
'Level 4 - Path-style parameters with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'{;hello:5}'
,
{
:
'Hello World!'
}
,
';hello=Hello'
)
;
testResolution
(
'{;list}'
,
,
';list=red,green,blue'
)
;
testResolution
(
'{;list*}'
,
,
';list=red;list=green;list=blue'
)
;
testResolution
(
'{;keys}'
,
,
';keys=semi,;,dot,.,comma,,'
)
;
testResolution
(
'{;keys*}'
,
,
';semi=;;dot=.;comma=,'
)
;
}
)
;
test
(
'Level 4 - Form-style query with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'{?var:3}'
,
,
'?var=val'
)
;
testResolution
(
'{?list}'
,
,
'?list=red,green,blue'
)
;
testResolution
(
'{?list*}'
,
,
'?list=red&list=green&list=blue'
)
;
testResolution
(
'{?keys}'
,
,
'?keys=semi,;,dot,.,comma,,'
)
;
testResolution
(
'{?keys*}'
,
,
'?semi=;&dot=.&comma=,'
)
;
}
)
;
test
(
'Level 4 - Form-style query continuation with value modifiers'
,
(
)
=>
{
const
=
{
var
:
'value'
,
:
[
'red'
,
'green'
,
'blue'
]
,
:
{
:
';'
,
:
'.'
,
:
','
}
}
;
testResolution
(
'?fixed=yes{&var:3}'
,
,
'?fixed=yes&var=val'
)
;
testResolution
(
'?fixed=yes{&list}'
,
,
'?fixed=yes&list=red,green,blue'
)
;
testResolution
(
'?fixed=yes{&list*}'
,
,
'?fixed=yes&list=red&list=green&list=blue'
)
;
testResolution
(
'?fixed=yes{&keys}'
,
,
'?fixed=yes&keys=semi,;,dot,.,comma,,'
)
;
testResolution
(
'?fixed=yes{&keys*}'
,
,
'?fixed=yes&semi=;&dot=.&comma=,'
)
;
}
)
;
test
(
'handling undefined or null values'
,
(
)
=>
{
const
=
{
:
'value'
,
:
undefined
,
null
:
null
,
:
''
}
;
testResolution
(
'{defined,undef,null,empty}'
,
,
'value,'
)
;
testResolution
(
'{+defined,undef,null,empty}'
,
,
'value,'
)
;
testResolution
(
'{#defined,undef,null,empty}'
,
,
'#value,'
)
;
testResolution
(
'X{.defined,undef,null,empty}'
,
,
'X.value'
)
;
testResolution
(
'{/defined,undef,null}'
,
,
'/value'
)
;
testResolution
(
'{;defined,empty}'
,
,
';defined=value;empty'
)
;
testResolution
(
'{?defined,undef,null,empty}'
,
,
'?defined=value&undef=&null=&empty='
)
;
testResolution
(
'{&defined,undef,null,empty}'
,
,
'&defined=value&undef=&null=&empty='
)
;
}
)
;
test
(
'complex templates'
,
(
)
=>
{
const
=
{
:
'example.com'
,
:
'fred'
,
:
[
'path'
,
'to'
,
'resource'
]
,
:
'search'
,
:
5
,
:
'en'
,
:
'123abc'
,
:
[
'color:blue'
,
'shape:square'
]
,
:
{
:
'37.7'
,
:
'-122.4'
}
}
;
testResolution
(
'https://{domain}/api/v1/users/{user}{/path*}{?query,page,lang}'
,
,
'https://example.com/api/v1/users/fred/path/to/resource?query=search&page=5&lang=en'
)
;
testResolution
(
'https://{domain}/search{?query,filters,coordinates*}'
,
,
'https://example.com/search?query=search&filters=color:blue,shape:square&lat=37.7&lon=-122.4'
)
;
testResolution
(
'https://{domain}/users/{user}/profile{.lang}{?sessionId}{#path}'
,
,
'https://example.com/users/fred/profile.en?sessionId=123abc#path,to,resource'
)
;
}
)
;
test
(
'literals and escaping'
,
(
)
=>
{
testParsing
(
'http://example.com/literal'
,
[
]
)
;
testParsing
(
'http://example.com/{var}literal{var2}'
,
[
{
:
'{var}'
,
:
''
,
:
[
{
:
false
,
:
'var'
,
:
false
,
:
undefined
,
:
false
}
]
}
,
{
:
'{var2}'
,
:
''
,
:
[
{
:
false
,
:
'var2'
,
:
false
,
:
undefined
,
:
false
}
]
}
]
)
;
testResolution
(
'http://example.com/{{var}}'
,
{
var
:
'value'
}
,
'http://example.com/{var}'
)
;
}
)
;
test
(
'edge cases'
,
(
)
=>
{
testResolution
(
''
,
{
}
,
''
)
;
testResolution
(
'http://example.com/path'
,
{
}
,
'http://example.com/path'
)
;
testResolution
(
'{var}'
,
{
}
,
''
)
;
testResolution
(
'{a}{b}{c}'
,
{
:
'1'
,
:
'2'
,
:
'3'
}
,
'123'
)
;
testResolution
(
'{_hidden.var-name$}'
,
{
'_hidden.var-name$'
:
'value'
}
,
'value'
)
;
}
)
;
}
)
;