Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8602a2c8
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,发现更多精彩内容 >>
提交
8602a2c8
编写于
1月 17, 2017
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add hot exit empty workspace tests
上级
fe9fb3bf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
179 addition
and
18 deletion
+179
-18
src/vs/workbench/services/textfile/test/textFileService.test.ts
.../workbench/services/textfile/test/textFileService.test.ts
+175
-18
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+4
-0
未找到文件。
src/vs/workbench/services/textfile/test/textFileService.test.ts
浏览文件 @
8602a2c8
...
...
@@ -8,7 +8,7 @@ import * as assert from 'assert';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ILifecycleService
,
ShutdownEvent
,
ShutdownReason
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
workbenchInstantiationService
,
TestLifecycleService
,
TestTextFileService
,
TestWindowsService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
workbenchInstantiationService
,
TestLifecycleService
,
TestTextFileService
,
TestWindowsService
,
TestContextService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
onError
,
toResource
}
from
'
vs/base/test/common/utils
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
...
...
@@ -19,13 +19,15 @@ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/un
import
{
UntitledEditorModel
}
from
'
vs/workbench/common/editor/untitledEditorModel
'
;
import
{
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
TextFileEditorModelManager
}
from
'
vs/workbench/services/textfile/common/textFileEditorModelManager
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
class
ServiceAccessor
{
constructor
(
@
ILifecycleService
public
lifecycleService
:
TestLifecycleService
,
@
ITextFileService
public
textFileService
:
TestTextFileService
,
@
IUntitledEditorService
public
untitledEditorService
:
IUntitledEditorService
,
@
IWindowsService
public
windowsService
:
TestWindowsService
@
IWindowsService
public
windowsService
:
TestWindowsService
,
@
IWorkspaceContextService
public
contextService
:
TestContextService
)
{
}
}
...
...
@@ -266,7 +268,7 @@ suite('Files - TextFileService', () => {
suite
(
'
Hot Exit
'
,
()
=>
{
suite
(
'
"onExit" setting
'
,
()
=>
{
test
(
'
should hot exit
(reason: CLOSE, windows: singl
e)
'
,
function
(
done
)
{
test
(
'
should hot exit
on non-Mac (reason: CLOSE, windows: single, workspac
e)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
...
...
@@ -278,8 +280,21 @@ suite('Files - TextFileService', () => {
}
},
done
);
});
test
(
'
should hot exit on non-Mac (reason: CLOSE, windows: single, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
if
(
platform
.
isMacintosh
)
{
// A single window CLOSE onMac does not imply an EXIT
assert
.
ok
(
veto
);
}
else
{
assert
.
ok
(
!
veto
);
}
},
done
);
});
test
(
'
should NOT hot exit (reason: CLOSE, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should NOT hot exit (reason: CLOSE, windows: multiple
, workspace
)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
...
...
@@ -288,32 +303,70 @@ suite('Files - TextFileService', () => {
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: single)
'
,
function
(
done
)
{
test
(
'
should NOT hot exit (reason: CLOSE, windows: multiple, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
veto
);
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: single, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: single, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: multiple, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: EXIT, windows: multiple
, empty workspace
)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: RELOAD, windows: single, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: RELOAD, windows: single)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: RELOAD, windows: single
, empty workspace
)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: RELOAD, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: RELOAD, windows: multiple
, workspace
)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
...
...
@@ -322,7 +375,17 @@ suite('Files - TextFileService', () => {
},
done
);
});
test
(
'
should NOT hot exit (reason: LOAD, windows: single)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: RELOAD, windows: multiple, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should NOT hot exit (reason: LOAD, windows: single, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
...
...
@@ -330,7 +393,16 @@ suite('Files - TextFileService', () => {
},
done
);
});
test
(
'
should NOT hot exit (reason: LOAD, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should NOT hot exit (reason: LOAD, windows: single, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
veto
);
},
done
);
});
test
(
'
should NOT hot exit (reason: LOAD, windows: multiple, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
...
...
@@ -338,18 +410,36 @@ suite('Files - TextFileService', () => {
assert
.
ok
(
veto
);
},
done
);
});
test
(
'
should NOT hot exit (reason: LOAD, windows: multiple, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
veto
);
},
done
);
});
});
suite
(
'
"onExitAndWindowClose" setting
'
,
()
=>
{
test
(
'
should hot exit (reason: CLOSE, windows: single)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: CLOSE, windows: single, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: CLOSE, windows: single, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: CLOSE, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: CLOSE, windows: multiple
, workspace
)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
...
...
@@ -358,7 +448,17 @@ suite('Files - TextFileService', () => {
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: single)
'
,
function
(
done
)
{
test
(
'
should NOT hot exit (reason: CLOSE, windows: multiple, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
CLOSE
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
veto
);
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: single, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
...
...
@@ -366,16 +466,35 @@ suite('Files - TextFileService', () => {
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: EXIT, windows: single, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: multiple, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: EXIT, windows: multiple, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: RELOAD, windows: single)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: RELOAD, windows: single
, workspace
)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
...
...
@@ -383,16 +502,35 @@ suite('Files - TextFileService', () => {
},
done
);
});
test
(
'
should hot exit (reason: RELOAD, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: RELOAD, windows: single, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: RELOAD, windows: multiple, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: RELOAD, windows: multiple, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
RELOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should hot exit (reason: LOAD, windows: single)
'
,
function
(
done
)
{
test
(
'
should hot exit (reason: LOAD, windows: single
, workspace
)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
...
...
@@ -400,7 +538,16 @@ suite('Files - TextFileService', () => {
},
done
);
});
test
(
'
should hot exit (reason: LOAD, windows: multiple)
'
,
function
(
done
)
{
test
(
'
should NOT hot exit (reason: LOAD, windows: single, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
veto
);
},
done
);
});
test
(
'
should hot exit (reason: LOAD, windows: multiple, workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
...
...
@@ -408,6 +555,16 @@ suite('Files - TextFileService', () => {
assert
.
ok
(
!
veto
);
},
done
);
});
test
(
'
should NOT hot exit (reason: LOAD, windows: multiple, empty workspace)
'
,
function
(
done
)
{
const
service
=
accessor
.
textFileService
;
accessor
.
windowsService
.
windowCount
=
2
;
accessor
.
contextService
.
setWorkspace
(
null
);
hotExitTest
.
call
(
this
,
HotExitConfiguration
.
ON_EXIT_AND_WINDOW_CLOSE
,
ShutdownReason
.
LOAD
,
(
veto
)
=>
{
assert
.
ok
(
!
service
.
cleanupBackupsBeforeShutdownCalled
);
assert
.
ok
(
veto
);
},
done
);
});
});
function
hotExitTest
(
setting
:
string
,
shutdownReason
:
ShutdownReason
,
assertions
:
(
veto
:
boolean
)
=>
void
,
done
):
void
{
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
8602a2c8
...
...
@@ -75,6 +75,10 @@ export class TestContextService implements IWorkspaceContextService {
return
this
.
workspace
;
}
public
setWorkspace
(
workspace
:
any
):
void
{
this
.
workspace
=
workspace
;
}
public
getOptions
()
{
return
this
.
options
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录