Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
39794c89
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,发现更多精彩内容 >>
提交
39794c89
编写于
6月 20, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix build
上级
850c1c37
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
13 deletion
+49
-13
src/vs/workbench/parts/terminal/test/electron-browser/terminalInstance.test.ts
...s/terminal/test/electron-browser/terminalInstance.test.ts
+13
-10
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+36
-3
未找到文件。
src/vs/workbench/parts/terminal/test/electron-browser/terminalInstance.test.ts
浏览文件 @
39794c89
...
...
@@ -10,21 +10,22 @@ import * as os from 'os';
import
Uri
from
'
vs/base/common/uri
'
;
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
import
{
I
LegacyWorkspace
,
I
WorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
TerminalInstance
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalInstance
'
;
import
{
IShellLaunchConfig
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
TestInstantiationService
}
from
'
vs/platform/instantiation/test/common/instantiationServiceMock
'
;
import
{
TestMessageService
,
TestContextService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
TestMessageService
,
TestContextService
,
TestHistoryService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
MockContextKeyService
,
MockKeybindingService
}
from
'
vs/platform/keybinding/test/common/mockKeybindingService
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IHistoryService
}
from
"
vs/workbench/services/history/common/history
"
;
class
TestTerminalInstance
extends
TerminalInstance
{
public
_getCwd
(
shell
:
IShellLaunchConfig
,
workspace
:
ILegacyWorkspace
):
string
{
return
super
.
_getCwd
(
shell
,
workspace
);
public
_getCwd
(
shell
:
IShellLaunchConfig
,
root
:
Uri
):
string
{
return
super
.
_getCwd
(
shell
,
root
);
}
protected
_createProcess
(
workspace
:
ILegacyWorkspace
,
shell
:
IShellLaunchConfig
):
void
{
}
protected
_createProcess
(
root
:
Uri
,
shell
:
IShellLaunchConfig
):
void
{
}
protected
_createXterm
():
void
{
}
}
...
...
@@ -35,6 +36,7 @@ suite('Workbench - TerminalInstance', () => {
setup
(()
=>
{
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IMessageService
,
new
TestMessageService
());
instantiationService
.
stub
(
IHistoryService
,
new
TestHistoryService
());
});
test
(
'
TerminalInstance - createTerminalEnv
'
,
function
()
{
...
...
@@ -89,6 +91,7 @@ suite('Workbench - TerminalInstance', () => {
instantiationService
.
stub
(
IWorkspaceContextService
,
new
TestContextService
());
instantiationService
.
stub
(
IKeybindingService
,
keybindingService
);
instantiationService
.
stub
(
IContextKeyService
,
contextKeyService
);
instantiationService
.
stub
(
IHistoryService
,
new
TestHistoryService
());
configHelper
=
{
config
:
{
cwd
:
null
...
...
@@ -107,7 +110,7 @@ suite('Workbench - TerminalInstance', () => {
});
test
(
'
should use to the workspace if it exists
'
,
()
=>
{
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
{
resource
:
Uri
.
file
(
'
/foo
'
)
}
),
'
/foo
'
);
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
Uri
.
file
(
'
/foo
'
)
),
'
/foo
'
);
});
test
(
'
should use an absolute custom cwd as is
'
,
()
=>
{
...
...
@@ -117,11 +120,11 @@ suite('Workbench - TerminalInstance', () => {
test
(
'
should normalize a relative custom cwd against the workspace path
'
,
()
=>
{
configHelper
.
config
.
cwd
=
'
foo
'
;
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
{
resource
:
Uri
.
file
(
'
/bar
'
)
}
),
'
/bar/foo
'
);
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
Uri
.
file
(
'
/bar
'
)
),
'
/bar/foo
'
);
configHelper
.
config
.
cwd
=
'
./foo
'
;
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
{
resource
:
Uri
.
file
(
'
/bar
'
)
}
),
'
/bar/foo
'
);
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
Uri
.
file
(
'
/bar
'
)
),
'
/bar/foo
'
);
configHelper
.
config
.
cwd
=
'
../foo
'
;
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
{
resource
:
Uri
.
file
(
'
/bar
'
)
}
,
),
'
/foo
'
);
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[]
},
Uri
.
file
(
'
/bar
'
)
,
),
'
/foo
'
);
});
test
(
'
should fall back for relative a custom cwd that doesn
\'
t have a workspace
'
,
()
=>
{
...
...
@@ -135,7 +138,7 @@ suite('Workbench - TerminalInstance', () => {
test
(
'
should ignore custom cwd when told to ignore
'
,
()
=>
{
configHelper
.
config
.
cwd
=
'
/foo
'
;
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[],
ignoreConfigurationCwd
:
true
},
{
resource
:
Uri
.
file
(
'
/bar
'
)
}
),
'
/bar
'
);
assertPathsMatch
(
instance
.
_getCwd
({
executable
:
null
,
args
:
[],
ignoreConfigurationCwd
:
true
},
Uri
.
file
(
'
/bar
'
)
),
'
/bar
'
);
});
});
});
\ No newline at end of file
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
39794c89
...
...
@@ -24,7 +24,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import
{
IPartService
,
Parts
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
TextModelResolverService
}
from
'
vs/workbench/services/textmodelResolver/common/textModelResolverService
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IEditorInput
,
IEditorOptions
,
Position
,
Direction
,
IEditor
,
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorInput
,
IEditorOptions
,
Position
,
Direction
,
IEditor
,
IResourceInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IUntitledEditorService
,
UntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IChoiceService
,
IMessageService
,
IConfirmation
}
from
'
vs/platform/message/common/message
'
;
import
{
ILegacyWorkspace
,
IWorkspaceContextService
,
IWorkspace
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -224,8 +224,7 @@ export function workbenchInstantiationService(): IInstantiationService {
instantiationService
.
stub
(
IPartService
,
new
TestPartService
());
instantiationService
.
stub
(
IEditorGroupService
,
new
TestEditorGroupService
());
instantiationService
.
stub
(
IModeService
,
ModeServiceImpl
);
instantiationService
.
stub
(
IHistoryService
,
{});
instantiationService
.
stub
(
IHistoryService
,
'
getHistory
'
,
[]);
instantiationService
.
stub
(
IHistoryService
,
new
TestHistoryService
());
instantiationService
.
stub
(
IModelService
,
instantiationService
.
createInstance
(
ModelServiceImpl
));
instantiationService
.
stub
(
IFileService
,
new
TestFileService
());
instantiationService
.
stub
(
IBackupFileService
,
new
TestBackupFileService
());
...
...
@@ -246,6 +245,40 @@ export function workbenchInstantiationService(): IInstantiationService {
return
instantiationService
;
}
export
class
TestHistoryService
implements
IHistoryService
{
public
_serviceBrand
:
any
;
constructor
(
private
root
?:
URI
)
{
}
public
reopenLastClosedEditor
():
void
{
}
public
add
(
input
:
IEditorInput
,
options
?:
ITextEditorOptions
):
void
{
}
public
forward
(
acrossEditors
?:
boolean
):
void
{
}
public
back
(
acrossEditors
?:
boolean
):
void
{
}
public
remove
(
input
:
IEditorInput
|
IResourceInput
):
void
{
}
public
clear
():
void
{
}
public
getHistory
():
(
IEditorInput
|
IResourceInput
)[]
{
return
[];
}
public
getLastActiveWorkspaceRoot
():
URI
{
return
this
.
root
;
}
}
export
class
TestMessageService
implements
IMessageService
{
public
_serviceBrand
:
any
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录