Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a7cf7c9f
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,发现更多精彩内容 >>
提交
a7cf7c9f
编写于
12月 07, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#64597 Move away from TPromise
上级
44c97db1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
12 deletion
+15
-12
src/vs/platform/instantiation/test/common/instantiationServiceMock.ts
...orm/instantiation/test/common/instantiationServiceMock.ts
+2
-3
src/vs/workbench/parts/search/test/common/searchResult.test.ts
...s/workbench/parts/search/test/common/searchResult.test.ts
+12
-7
src/vs/workbench/services/preferences/test/common/keybindingsEditorModel.test.ts
...es/preferences/test/common/keybindingsEditorModel.test.ts
+1
-2
未找到文件。
src/vs/platform/instantiation/test/common/instantiationServiceMock.ts
浏览文件 @
a7cf7c9f
...
...
@@ -8,7 +8,6 @@ import * as types from 'vs/base/common/types';
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
interface
IServiceMock
<
T
>
{
id
:
ServiceIdentifier
<
T
>
;
...
...
@@ -72,8 +71,8 @@ export class TestInstantiationService extends InstantiationService {
public
stubPromise
<
T
>
(
service
?:
ServiceIdentifier
<
T
>
,
ctor
?:
any
,
fnProperty
?:
string
,
value
?:
any
):
sinon
.
SinonStub
;
public
stubPromise
<
T
>
(
service
?:
ServiceIdentifier
<
T
>
,
obj
?:
any
,
fnProperty
?:
string
,
value
?:
any
):
sinon
.
SinonStub
;
public
stubPromise
(
arg1
?:
any
,
arg2
?:
any
,
arg3
?:
any
,
arg4
?:
any
):
sinon
.
SinonStub
{
arg3
=
typeof
arg2
===
'
string
'
?
TPromise
.
as
(
arg3
)
:
arg3
;
arg4
=
typeof
arg2
!==
'
string
'
&&
typeof
arg3
===
'
string
'
?
TPromise
.
as
(
arg4
)
:
arg4
;
arg3
=
typeof
arg2
===
'
string
'
?
Promise
.
resolve
(
arg3
)
:
arg3
;
arg4
=
typeof
arg2
!==
'
string
'
&&
typeof
arg3
===
'
string
'
?
Promise
.
resolve
(
arg4
)
:
arg4
;
return
this
.
stub
(
arg1
,
arg2
,
arg3
,
arg4
);
}
...
...
src/vs/workbench/parts/search/test/common/searchResult.test.ts
浏览文件 @
a7cf7c9f
...
...
@@ -266,7 +266,8 @@ suite('SearchResult', () => {
});
test
(
'
replace should remove the file match
'
,
function
()
{
instantiationService
.
stubPromise
(
IReplaceService
,
'
replace
'
,
null
);
const
voidPromise
=
Promise
.
resolve
(
null
);
instantiationService
.
stub
(
IReplaceService
,
'
replace
'
,
voidPromise
);
let
testObject
=
aSearchResult
();
testObject
.
add
([
aRawMatch
(
'
file://c:/1
'
,
...
...
@@ -274,12 +275,13 @@ suite('SearchResult', () => {
testObject
.
replace
(
testObject
.
matches
()[
0
]);
assert
.
ok
(
testObject
.
isEmpty
(
));
return
voidPromise
.
then
(()
=>
assert
.
ok
(
testObject
.
isEmpty
()
));
});
test
(
'
replace should trigger the change event
'
,
function
()
{
let
target
=
sinon
.
spy
();
instantiationService
.
stubPromise
(
IReplaceService
,
'
replace
'
,
null
);
const
voidPromise
=
Promise
.
resolve
(
null
);
instantiationService
.
stub
(
IReplaceService
,
'
replace
'
,
voidPromise
);
let
testObject
=
aSearchResult
();
testObject
.
add
([
aRawMatch
(
'
file://c:/1
'
,
...
...
@@ -289,12 +291,15 @@ suite('SearchResult', () => {
testObject
.
replace
(
objectRoRemove
);
return
voidPromise
.
then
(()
=>
{
assert
.
ok
(
target
.
calledOnce
);
assert
.
deepEqual
([{
elements
:
[
objectRoRemove
],
removed
:
true
}],
target
.
args
[
0
]);
});
});
test
(
'
replaceAll should remove all file matches
'
,
function
()
{
instantiationService
.
stubPromise
(
IReplaceService
,
'
replace
'
,
null
);
const
voidPromise
=
Promise
.
resolve
(
null
);
instantiationService
.
stubPromise
(
IReplaceService
,
'
replace
'
,
voidPromise
);
let
testObject
=
aSearchResult
();
testObject
.
add
([
aRawMatch
(
'
file://c:/1
'
,
...
...
@@ -304,7 +309,7 @@ suite('SearchResult', () => {
testObject
.
replaceAll
(
null
);
assert
.
ok
(
testObject
.
isEmpty
(
));
return
voidPromise
.
then
(()
=>
assert
.
ok
(
testObject
.
isEmpty
()
));
});
//// ----- utils
...
...
src/vs/workbench/services/preferences/test/common/keybindingsEditorModel.test.ts
浏览文件 @
a7cf7c9f
...
...
@@ -5,7 +5,6 @@
import
*
as
assert
from
'
assert
'
;
import
*
as
uuid
from
'
vs/base/common/uuid
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
OS
,
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
...
...
@@ -44,7 +43,7 @@ suite('KeybindingsEditorModel test', () => {
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IKeybindingService
,
{});
instantiationService
.
stub
(
IExtensionService
,
{},
'
whenInstalledExtensionsRegistered
'
,
()
=>
TPromise
.
as
(
null
));
instantiationService
.
stub
(
IExtensionService
,
{},
'
whenInstalledExtensionsRegistered
'
,
()
=>
Promise
.
resolve
(
null
));
testObject
=
instantiationService
.
createInstance
(
KeybindingsEditorModel
,
OS
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录