Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bf3ab10e
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bf3ab10e
编写于
5月 08, 2017
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix test failure as IStorageService is not initalized in test
上级
6e0d024a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
17 deletion
+26
-17
src/vs/editor/contrib/find/test/common/findController.test.ts
...vs/editor/contrib/find/test/common/findController.test.ts
+24
-16
src/vs/editor/test/common/mocks/mockCodeEditor.ts
src/vs/editor/test/common/mocks/mockCodeEditor.ts
+2
-1
未找到文件。
src/vs/editor/contrib/find/test/common/findController.test.ts
浏览文件 @
bf3ab10e
...
...
@@ -17,10 +17,12 @@ import {
NextMatchFindAction
,
StartFindAction
,
SelectHighlightsAction
,
AddSelectionToNextFindMatchAction
}
from
'
vs/editor/contrib/find/common/findController
'
;
import
{
FindReplaceState
}
from
'
vs/editor/contrib/find/common/findState
'
;
import
{
MockCodeEditor
,
withMockCodeEditor
}
from
'
vs/editor/test/common/mocks/mockCodeEditor
'
;
import
{
HistoryNavigator
}
from
'
vs/base/common/history
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
class
TestFindController
extends
CommonFindController
{
...
...
@@ -68,7 +70,13 @@ class TestFindController extends CommonFindController {
}
suite
(
'
FindController
'
,
()
=>
{
let
queryState
=
new
FindReplaceState
();
let
serviceCollection
=
new
ServiceCollection
();
serviceCollection
.
set
(
IStorageService
,
<
any
>
{
get
:
(
key
)
=>
queryState
[
key
],
getBoolean
:
(
key
)
=>
!!
queryState
[
key
],
store
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
}
});
function
fromRange
(
rng
:
Range
):
number
[]
{
return
[
rng
.
startLineNumber
,
rng
.
startColumn
,
rng
.
endLineNumber
,
rng
.
endColumn
];
}
...
...
@@ -79,7 +87,7 @@ suite('FindController', () => {
'
ABC
'
,
'
XYZ
'
,
'
ABC
'
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
// The cursor is at the very top, of the file, at the first ABC
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
...
...
@@ -134,7 +142,7 @@ suite('FindController', () => {
test
(
'
issue #3090: F3 does not loop with two matches on a single line
'
,
()
=>
{
withMockCodeEditor
([
'
import nls = require(
\'
vs/nls
\'
);
'
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
nextMatchFindAction
=
new
NextMatchFindAction
();
...
...
@@ -159,7 +167,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
startFindAction
=
new
StartFindAction
();
...
...
@@ -185,7 +193,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
selectHighlightsAction
=
new
SelectHighlightsAction
();
...
...
@@ -212,7 +220,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
findController
.
start
({
...
...
@@ -240,7 +248,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
findController
.
getState
().
change
({
searchString
:
'
1
'
},
false
);
...
...
@@ -256,7 +264,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
findController
.
delayUpdateHistory
=
true
;
...
...
@@ -276,7 +284,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
findController
.
getState
().
change
({
searchString
:
'
1
'
},
false
);
...
...
@@ -293,7 +301,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
findController
.
getState
().
change
({
searchString
:
'
1
'
},
false
);
...
...
@@ -310,7 +318,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
findController
.
getState
().
change
({
searchString
:
'
1
'
},
false
);
...
...
@@ -330,7 +338,7 @@ suite('FindController', () => {
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
findController
.
getState
().
change
({
searchString
:
'
1
'
},
false
);
...
...
@@ -356,7 +364,7 @@ suite('FindController', () => {
'
rty
'
,
'
qwe
'
,
'
rty
'
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
addSelectionToNextFindMatch
=
new
AddSelectionToNextFindMatchAction
();
...
...
@@ -388,7 +396,7 @@ suite('FindController', () => {
'
rty
'
,
'
qwe
'
,
'
rty
'
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
editor
.
getModel
().
setEOL
(
EndOfLineSequence
.
CRLF
);
...
...
@@ -414,7 +422,7 @@ suite('FindController', () => {
test
(
'
issue #18111: Regex replace with single space replaces with no space
'
,
()
=>
{
withMockCodeEditor
([
'
HRESULT OnAmbientPropertyChange(DISPID dispid);
'
],
{},
(
editor
,
cursor
)
=>
{
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
...
...
@@ -448,7 +456,7 @@ suite('FindController', () => {
}
function
testAddSelectionToNextFindMatchAction
(
text
:
string
[],
callback
:
(
editor
:
MockCodeEditor
,
action
:
AddSelectionToNextFindMatchAction
,
findController
:
TestFindController
)
=>
void
):
void
{
withMockCodeEditor
(
text
,
{},
(
editor
,
cursor
)
=>
{
withMockCodeEditor
(
text
,
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
...
...
src/vs/editor/test/common/mocks/mockCodeEditor.ts
浏览文件 @
bf3ab10e
...
...
@@ -85,6 +85,7 @@ export interface MockCodeEditorCreationOptions extends editorOptions.IEditorOpti
* The initial model associated with this code editor.
*/
model
?:
editorCommon
.
IModel
;
serviceCollection
?:
ServiceCollection
;
}
export
function
withMockCodeEditor
(
text
:
string
[],
options
:
MockCodeEditorCreationOptions
,
callback
:
(
editor
:
MockCodeEditor
,
cursor
:
Cursor
)
=>
void
):
void
{
...
...
@@ -97,7 +98,7 @@ export function mockCodeEditor(text: string[], options: MockCodeEditorCreationOp
let
contextKeyService
=
new
MockContextKeyService
();
let
services
=
new
ServiceCollection
();
let
services
=
options
.
serviceCollection
||
new
ServiceCollection
();
services
.
set
(
IContextKeyService
,
contextKeyService
);
let
instantiationService
=
new
InstantiationService
(
services
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录