Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
87de60cc
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,体验更适合开发者的 AI 搜索 >>
提交
87de60cc
编写于
7月 22, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix tests
上级
b1f6b66d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
20 deletion
+24
-20
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
...tform/backup/test/electron-main/backupMainService.test.ts
+23
-19
src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts
...eybinding/test/electron-browser/keybindingEditing.test.ts
+1
-1
未找到文件。
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
浏览文件 @
87de60cc
...
...
@@ -73,28 +73,28 @@ suite('BackupMainService', () => {
};
}
function
ensureFolderExists
(
uri
:
Uri
):
void
{
async
function
ensureFolderExists
(
uri
:
Uri
):
Promise
<
void
>
{
if
(
!
fs
.
existsSync
(
uri
.
fsPath
))
{
fs
.
mkdirSync
(
uri
.
fsPath
);
}
const
backupFolder
=
service
.
toBackupPath
(
uri
);
createBackupFolder
(
backupFolder
);
await
createBackupFolder
(
backupFolder
);
}
function
ensureWorkspaceExists
(
workspace
:
IWorkspaceIdentifier
):
IWorkspaceIdentifier
{
async
function
ensureWorkspaceExists
(
workspace
:
IWorkspaceIdentifier
):
Promise
<
IWorkspaceIdentifier
>
{
if
(
!
fs
.
existsSync
(
workspace
.
configPath
))
{
fs
.
writeFile
(
workspace
.
configPath
,
'
Hello
'
);
await
p
fs
.
writeFile
(
workspace
.
configPath
,
'
Hello
'
);
}
const
backupFolder
=
service
.
toBackupPath
(
workspace
.
id
);
createBackupFolder
(
backupFolder
);
await
createBackupFolder
(
backupFolder
);
return
workspace
;
}
function
createBackupFolder
(
backupFolder
:
string
)
{
async
function
createBackupFolder
(
backupFolder
:
string
):
Promise
<
void
>
{
if
(
!
fs
.
existsSync
(
backupFolder
))
{
fs
.
mkdirSync
(
backupFolder
);
fs
.
mkdirSync
(
path
.
join
(
backupFolder
,
Schemas
.
file
));
fs
.
writeFile
(
path
.
join
(
backupFolder
,
Schemas
.
file
,
'
foo.txt
'
),
'
Hello
'
);
await
p
fs
.
writeFile
(
path
.
join
(
backupFolder
,
Schemas
.
file
,
'
foo.txt
'
),
'
Hello
'
);
}
}
...
...
@@ -256,7 +256,7 @@ suite('BackupMainService', () => {
suite
(
'
migrate folderPath to folderURI
'
,
()
=>
{
test
(
'
migration makes sure to preserve existing backups
'
,
()
=>
{
test
(
'
migration makes sure to preserve existing backups
'
,
async
()
=>
{
let
path1
=
path
.
join
(
parentDir
,
'
folder1
'
).
toLowerCase
();
let
path2
=
path
.
join
(
parentDir
,
'
folder2
'
).
toUpperCase
();
let
uri1
=
Uri
.
file
(
path1
);
...
...
@@ -272,17 +272,17 @@ suite('BackupMainService', () => {
if
(
!
fs
.
existsSync
(
backupFolder1
))
{
fs
.
mkdirSync
(
backupFolder1
);
fs
.
mkdirSync
(
path
.
join
(
backupFolder1
,
Schemas
.
file
));
fs
.
writeFile
(
path
.
join
(
backupFolder1
,
Schemas
.
file
,
'
unsaved1.txt
'
),
'
Legacy
'
);
await
p
fs
.
writeFile
(
path
.
join
(
backupFolder1
,
Schemas
.
file
,
'
unsaved1.txt
'
),
'
Legacy
'
);
}
const
backupFolder2
=
service
.
toLegacyBackupPath
(
path2
);
if
(
!
fs
.
existsSync
(
backupFolder2
))
{
fs
.
mkdirSync
(
backupFolder2
);
fs
.
mkdirSync
(
path
.
join
(
backupFolder2
,
Schemas
.
file
));
fs
.
writeFile
(
path
.
join
(
backupFolder2
,
Schemas
.
file
,
'
unsaved2.txt
'
),
'
Legacy
'
);
await
p
fs
.
writeFile
(
path
.
join
(
backupFolder2
,
Schemas
.
file
,
'
unsaved2.txt
'
),
'
Legacy
'
);
}
const
workspacesJson
=
{
rootWorkspaces
:
[],
folderWorkspaces
:
[
path1
,
path2
],
emptyWorkspaces
:
[]
};
return
pfs
.
writeFile
(
backupWorkspacesPath
,
JSON
.
stringify
(
workspacesJson
)).
then
(()
=>
{
await
pfs
.
writeFile
(
backupWorkspacesPath
,
JSON
.
stringify
(
workspacesJson
)).
then
(()
=>
{
service
.
loadSync
();
return
pfs
.
readFile
(
backupWorkspacesPath
,
'
utf-8
'
).
then
(
content
=>
{
const
json
=
<
IBackupWorkspacesFormat
>
JSON
.
parse
(
content
);
...
...
@@ -446,9 +446,9 @@ suite('BackupMainService', () => {
});
suite
(
'
dedupeFolderWorkspaces
'
,
()
=>
{
test
(
'
should ignore duplicates (folder workspace)
'
,
()
=>
{
test
(
'
should ignore duplicates (folder workspace)
'
,
async
()
=>
{
ensureFolderExists
(
existingTestFolder1
);
await
ensureFolderExists
(
existingTestFolder1
);
const
workspacesJson
:
IBackupWorkspacesFormat
=
{
rootWorkspaces
:
[],
...
...
@@ -464,9 +464,9 @@ suite('BackupMainService', () => {
});
});
test
(
'
should ignore duplicates on Windows and Mac (folder workspace)
'
,
()
=>
{
test
(
'
should ignore duplicates on Windows and Mac (folder workspace)
'
,
async
()
=>
{
ensureFolderExists
(
existingTestFolder1
);
await
ensureFolderExists
(
existingTestFolder1
);
const
workspacesJson
:
IBackupWorkspacesFormat
=
{
rootWorkspaces
:
[],
...
...
@@ -482,11 +482,15 @@ suite('BackupMainService', () => {
});
});
test
(
'
should ignore duplicates on Windows and Mac (root workspace)
'
,
()
=>
{
test
(
'
should ignore duplicates on Windows and Mac (root workspace)
'
,
async
()
=>
{
const
workspacePath
=
path
.
join
(
parentDir
,
'
Foo.code-workspace
'
);
const
workspace1
=
await
ensureWorkspaceExists
(
toWorkspace
(
workspacePath
));
const
workspace2
=
await
ensureWorkspaceExists
(
toWorkspace
(
workspacePath
.
toUpperCase
()));
const
workspace3
=
await
ensureWorkspaceExists
(
toWorkspace
(
workspacePath
.
toLowerCase
()));
const
workspacesJson
:
IBackupWorkspacesFormat
=
{
rootWorkspaces
:
[
ensureWorkspaceExists
(
toWorkspace
(
workspacePath
)),
ensureWorkspaceExists
(
toWorkspace
(
workspacePath
.
toUpperCase
())),
ensureWorkspaceExists
(
toWorkspace
(
workspacePath
.
toLowerCase
()))
],
rootWorkspaces
:
[
workspace1
,
workspace2
,
workspace3
],
folderURIWorkspaces
:
[],
emptyWorkspaces
:
[]
};
...
...
@@ -603,9 +607,9 @@ suite('BackupMainService', () => {
});
});
test
(
'
should fail gracefully when removing a path that doesn
\'
t exist
'
,
()
=>
{
test
(
'
should fail gracefully when removing a path that doesn
\'
t exist
'
,
async
()
=>
{
ensureFolderExists
(
existingTestFolder1
);
// make sure backup folder exists, so the folder is not removed on loadSync
await
ensureFolderExists
(
existingTestFolder1
);
// make sure backup folder exists, so the folder is not removed on loadSync
const
workspacesJson
:
IBackupWorkspacesFormat
=
{
rootWorkspaces
:
[],
folderURIWorkspaces
:
[
existingTestFolder1
.
toString
()],
emptyWorkspaces
:
[]
};
return
pfs
.
writeFile
(
backupWorkspacesPath
,
JSON
.
stringify
(
workspacesJson
)).
then
(()
=>
{
...
...
src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts
浏览文件 @
87de60cc
...
...
@@ -69,7 +69,7 @@ suite('KeybindingsEditing', () => {
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IEnvironmentService
,
{
appKeybindingsPath
:
keybindingsFile
});
instantiationService
.
stub
(
IEnvironmentService
,
<
IEnvironmentService
>
{
appKeybindingsPath
:
keybindingsFile
,
appSettingsPath
:
path
.
join
(
testDir
,
'
settings.json
'
)
});
instantiationService
.
stub
(
IConfigurationService
,
ConfigurationService
);
instantiationService
.
stub
(
IConfigurationService
,
'
getValue
'
,
{
'
eol
'
:
'
\n
'
});
instantiationService
.
stub
(
IConfigurationService
,
'
onDidUpdateConfiguration
'
,
()
=>
{
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录