ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / services / search / test / common / replace.test.ts 263 строк · изменён 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
import assert from 'assert' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js' ;
import { ReplacePattern } from '../../common/replace.js' ;
suite ( 'Replace Pattern test' , ( ) => {
ensureNoDisposablesAreLeakedInTestSuite ( ) ;
test ( 'parse replace string' , ( ) => {
const testParse = ( input: string , expected: string , expectedHasParameters:
actual input pattern isRegExp
assert expected actual pattern
assert expectedHasParameters actual hasParameters
actual input pattern isRegExp
assert expected actual pattern
assert expectedHasParameters actual hasParameters
expected
actual expected regExp
assert actual expected
expected
actual regExp
assert actual expected
testObject
assert testObject hasParameters
testObject
assert testObject hasParameters
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
actual testObject
assert actual
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject pattern isRegExp
actual testObject
assert actual
testObject
actual testObject
assert actual
testObject
actual testObject
assert actual
testObject
actual testObject
assert actual
testObject
actual testObject
assert actual
boolean
)
=>
{
let
=
new
ReplacePattern
(
,
{
:
'somepattern'
,
:
true
}
)
;
.
strictEqual
(
,
.
)
;
.
strictEqual
(
,
.
)
;
=
new
ReplacePattern
(
'hello'
+
+
'hi'
,
{
:
'sonepattern'
,
:
true
}
)
;
.
strictEqual
(
'hello'
+
+
'hi'
,
.
)
;
.
strictEqual
(
,
.
)
;
}
;
testParse
(
'hello'
,
'hello'
,
false
)
;
testParse
(
'\\thello'
,
'\thello'
,
false
)
;
testParse
(
'\\nhello'
,
'\nhello'
,
false
)
;
testParse
(
'\\\\thello'
,
'\\thello'
,
false
)
;
testParse
(
'\\\\\\thello'
,
'\\\thello'
,
false
)
;
testParse
(
'\\\\\\\\thello'
,
'\\\\thello'
,
false
)
;
testParse
(
'hello\\'
,
'hello\\'
,
false
)
;
testParse
(
'hello\\x'
,
'hello\\x'
,
false
)
;
testParse
(
'hello\\0'
,
'hello\\0'
,
false
)
;
testParse
(
'hello$1'
,
'hello$1'
,
true
)
;
testParse
(
'hello$2'
,
'hello$2'
,
true
)
;
testParse
(
'hello$12'
,
'hello$12'
,
true
)
;
testParse
(
'hello$99'
,
'hello$99'
,
true
)
;
testParse
(
'hello$99a'
,
'hello$99a'
,
true
)
;
testParse
(
'hello$100'
,
'hello$100'
,
false
)
;
testParse
(
'hello$100a'
,
'hello$100a'
,
false
)
;
testParse
(
'hello$10a0'
,
'hello$10a0'
,
true
)
;
testParse
(
'hello$$'
,
'hello$$'
,
false
)
;
testParse
(
'hello$$0'
,
'hello$$0'
,
false
)
;
testParse
(
'hello$0'
,
'hello$&'
,
true
)
;
testParse
(
'hello$02'
,
'hello$&2'
,
true
)
;
testParse
(
'hello$`'
,
'hello$`'
,
true
)
;
testParse
(
'hello$\''
,
'hello$\''
,
true
)
;
}
)
;
test
(
'create pattern by passing regExp'
,
(
)
=>
{
let
=
/ abc /
;
let
=
new
ReplacePattern
(
'hello'
,
false
,
)
.
;
.
deepStrictEqual
(
,
)
;
=
/ abc /
;
=
new
ReplacePattern
(
'hello'
,
false
,
/ abc / g
)
.
;
.
deepStrictEqual
(
,
)
;
let
=
new
ReplacePattern
(
'hello$0'
,
false
,
/ abc / g
)
;
.
strictEqual
(
.
,
false
)
;
=
new
ReplacePattern
(
'hello$0'
,
true
,
/ abc / g
)
;
.
strictEqual
(
.
,
true
)
;
}
)
;
test
(
'get replace string if given text is a complete match'
,
(
)
=>
{
let
=
new
ReplacePattern
(
'hello'
,
{
:
'bla'
,
:
true
}
)
;
let
=
.
getReplaceString
(
'bla'
)
;
.
strictEqual
(
,
'hello'
)
;
=
new
ReplacePattern
(
'hello'
,
{
:
'bla'
,
:
false
}
)
;
=
.
getReplaceString
(
'bla'
)
;
.
strictEqual
(
,
'hello'
)
;
=
new
ReplacePattern
(
'hello'
,
{
:
'(bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'bla'
)
;
.
strictEqual
(
,
'hello'
)
;
=
new
ReplacePattern
(
'hello$0'
,
{
:
'(bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'bla'
)
;
.
strictEqual
(
,
'hellobla'
)
;
=
new
ReplacePattern
(
'import * as $1 from \'$2\';'
,
{
:
'let\\s+(\\w+)\\s*=\\s*require\\s*\\(\\s*[\'\"]([\\w.\\-/]+)\\s*[\'\"]\\s*\\)\\s*'
,
:
true
}
)
;
=
.
getReplaceString
(
'let fs = require(\'fs\')'
)
;
.
strictEqual
(
,
'import * as fs from \'fs\';'
)
;
=
.
getReplaceString
(
'let something = require(\'fs\')'
)
;
.
strictEqual
(
,
'import * as something from \'fs\';'
)
;
=
.
getReplaceString
(
'let require(\'fs\')'
)
;
.
strictEqual
(
,
null
)
;
=
new
ReplacePattern
(
'import * as $1 from \'$1\';'
,
{
:
'let\\s+(\\w+)\\s*=\\s*require\\s*\\(\\s*[\'\"]([\\w.\\-/]+)\\s*[\'\"]\\s*\\)\\s*'
,
:
true
}
)
;
=
.
getReplaceString
(
'let something = require(\'fs\')'
)
;
.
strictEqual
(
,
'import * as something from \'something\';'
)
;
=
new
ReplacePattern
(
'import * as $2 from \'$1\';'
,
{
:
'let\\s+(\\w+)\\s*=\\s*require\\s*\\(\\s*[\'\"]([\\w.\\-/]+)\\s*[\'\"]\\s*\\)\\s*'
,
:
true
}
)
;
=
.
getReplaceString
(
'let something = require(\'fs\')'
)
;
.
strictEqual
(
,
'import * as fs from \'something\';'
)
;
=
new
ReplacePattern
(
'import * as $0 from \'$0\';'
,
{
:
'let\\s+(\\w+)\\s*=\\s*require\\s*\\(\\s*[\'\"]([\\w.\\-/]+)\\s*[\'\"]\\s*\\)\\s*'
,
:
true
}
)
;
=
.
getReplaceString
(
'let something = require(\'fs\');'
)
;
.
strictEqual
(
,
'import * as let something = require(\'fs\') from \'let something = require(\'fs\')\';'
)
;
=
new
ReplacePattern
(
'import * as $1 from \'$2\';'
,
{
:
'let\\s+(\\w+)\\s*=\\s*require\\s*\\(\\s*[\'\"]([\\w.\\-/]+)\\s*[\'\"]\\s*\\)\\s*'
,
:
false
}
)
;
=
.
getReplaceString
(
'let fs = require(\'fs\');'
)
;
.
strictEqual
(
,
null
)
;
=
new
ReplacePattern
(
'cat$1'
,
{
:
'for(.*)'
,
:
true
}
)
;
=
.
getReplaceString
(
'for ()'
)
;
.
strictEqual
(
,
'cat ()'
)
;
}
)
;
test
(
'case operations'
,
(
)
=>
{
const
=
new
ReplacePattern
(
'a\\u$1l\\u\\l\\U$2M$3n'
,
{
:
'a(l)l(good)m(e)n'
,
:
true
}
)
;
const
=
.
getReplaceString
(
'allgoodmen'
)
;
.
strictEqual
(
,
'aLlGoODMen'
)
;
}
)
;
test
(
'case operations - no false positive'
,
(
)
=>
{
let
=
new
ReplacePattern
(
'\\left $1'
,
{
:
'(pattern)'
,
:
true
}
)
;
let
=
.
getReplaceString
(
'pattern'
)
;
.
strictEqual
(
,
'\\left pattern'
)
;
=
new
ReplacePattern
(
'\\hi \\left $1'
,
{
:
'(pattern)'
,
:
true
}
)
;
=
.
getReplaceString
(
'pattern'
)
;
.
strictEqual
(
,
'\\hi \\left pattern'
)
;
=
new
ReplacePattern
(
'\\left \\L$1'
,
{
:
'PATT(ERN)'
,
:
true
}
)
;
=
.
getReplaceString
(
'PATTERN'
)
;
.
strictEqual
(
,
'\\left ern'
)
;
}
)
;
test
(
'case operations and newline'
,
(
)
=>
{
const
=
new
ReplacePattern
(
'$1\n\\U$2'
,
{
:
'(multi)(line)'
,
:
true
}
)
;
const
=
.
getReplaceString
(
'multiline'
)
;
.
strictEqual
(
,
'multi\nLINE'
)
;
}
)
;
test
(
'get replace string for no matches'
,
(
)
=>
{
let
=
new
ReplacePattern
(
'hello'
,
{
:
'bla'
,
:
true
}
)
;
let
=
.
getReplaceString
(
'foo'
)
;
.
strictEqual
(
,
null
)
;
=
new
ReplacePattern
(
'hello'
,
{
:
'bla'
,
:
false
}
)
;
=
.
getReplaceString
(
'foo'
)
;
.
strictEqual
(
,
null
)
;
}
)
;
test
(
'get replace string if match is sub-string of the text'
,
(
)
=>
{
let
=
new
ReplacePattern
(
'hello'
,
{
:
'bla'
,
:
true
}
)
;
let
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'hello'
)
;
=
new
ReplacePattern
(
'hello'
,
{
:
'bla'
,
:
false
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'hello'
)
;
=
new
ReplacePattern
(
'that'
,
{
:
'this(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'that'
)
;
=
new
ReplacePattern
(
'$1at'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'that'
)
;
=
new
ReplacePattern
(
'$1e'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'the'
)
;
=
new
ReplacePattern
(
'$1ere'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'there'
)
;
=
new
ReplacePattern
(
'$1'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'th'
)
;
=
new
ReplacePattern
(
'ma$1'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'math'
)
;
=
new
ReplacePattern
(
'ma$1s'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'maths'
)
;
=
new
ReplacePattern
(
'ma$1s'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'maths'
)
;
=
new
ReplacePattern
(
'$0'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'this'
)
;
=
new
ReplacePattern
(
'$0$1'
,
{
:
'(th)is(?=.*bla)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'thisth'
)
;
=
new
ReplacePattern
(
'foo'
,
{
:
'bla(?=\\stext$)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'foo'
)
;
=
new
ReplacePattern
(
'f$1'
,
{
:
'b(la)(?=\\stext$)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'fla'
)
;
=
new
ReplacePattern
(
'f$0'
,
{
:
'b(la)(?=\\stext$)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'fbla'
)
;
=
new
ReplacePattern
(
'$0ah'
,
{
:
'b(la)(?=\\stext$)'
,
:
true
}
)
;
=
.
getReplaceString
(
'this is a bla text'
)
;
.
strictEqual
(
,
'blaah'
)
;
=
new
ReplacePattern
(
'newrege$1'
,
true
,
/ Testrege( \w * ) /
)
;
=
.
getReplaceString
(
'Testregex'
,
true
)
;
.
strictEqual
(
,
'Newregex'
)
;
=
new
ReplacePattern
(
'newrege$1'
,
true
,
/ TESTREGE( \w * ) /
)
;
=
.
getReplaceString
(
'TESTREGEX'
,
true
)
;
.
strictEqual
(
,
'NEWREGEX'
)
;
=
new
ReplacePattern
(
'new_rege$1'
,
true
,
/ Test_Rege( \w * ) /
)
;
=
.
getReplaceString
(
'Test_Regex'
,
true
)
;
.
strictEqual
(
,
'New_Regex'
)
;
=
new
ReplacePattern
(
'new-rege$1'
,
true
,
/ Test-Rege( \w * ) /
)
;
=
.
getReplaceString
(
'Test-Regex'
,
true
)
;
.
strictEqual
(
,
'New-Regex'
)
;
}
)
;
}
)
;