Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
52b465d7
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
52b465d7
编写于
11月 20, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove blocking calls from tests.
上级
6ff4eecc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
19 deletion
+19
-19
src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs
...torFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs
+14
-14
src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTestBase.cs
...eatures/CSharpTest/Formatting/FormattingEngineTestBase.cs
+2
-2
src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTests.cs
...orFeatures/CSharpTest/Formatting/FormattingEngineTests.cs
+2
-2
src/EditorFeatures/CSharpTest/Formatting/Indentation/FormatterTestsBase.cs
...s/CSharpTest/Formatting/Indentation/FormatterTestsBase.cs
+1
-1
未找到文件。
src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs
浏览文件 @
52b465d7
...
...
@@ -21,7 +21,7 @@ protected async Task ExpectExtractMethodToFailAsync(string codeWithMarker, bool
{
var
testDocument
=
workspace
.
Documents
.
First
();
var
textSpan
=
testDocument
.
SelectedSpans
.
Single
();
var
treeAfterExtractMethod
=
ExtractMethod
(
workspace
,
testDocument
,
succeed
:
false
,
allowMovingDeclaration
:
allowMovingDeclaration
,
dontPutOutOrRefOnStruct
:
dontPutOutOrRefOnStruct
);
var
treeAfterExtractMethod
=
await
ExtractMethodAsync
(
workspace
,
testDocument
,
succeed
:
false
,
allowMovingDeclaration
:
allowMovingDeclaration
,
dontPutOutOrRefOnStruct
:
dontPutOutOrRefOnStruct
);
}
}
...
...
@@ -37,7 +37,7 @@ protected async Task ExpectExtractMethodToFailAsync(string codeWithMarker, bool
var
testDocument
=
workspace
.
Documents
.
Single
();
var
subjectBuffer
=
testDocument
.
TextBuffer
;
var
tree
=
ExtractMethod
(
workspace
,
testDocument
,
succeed
:
false
,
allowMovingDeclaration
:
allowMovingDeclaration
,
dontPutOutOrRefOnStruct
:
dontPutOutOrRefOnStruct
);
var
tree
=
await
ExtractMethodAsync
(
workspace
,
testDocument
,
succeed
:
false
,
allowMovingDeclaration
:
allowMovingDeclaration
,
dontPutOutOrRefOnStruct
:
dontPutOutOrRefOnStruct
);
using
(
var
edit
=
subjectBuffer
.
CreateEdit
())
{
...
...
@@ -53,10 +53,10 @@ protected async Task NotSupported_ExtractMethodAsync(string codeWithMarker)
{
using
(
var
workspace
=
await
CSharpWorkspaceFactory
.
CreateWorkspaceFromLinesAsync
(
codeWithMarker
))
{
Assert
.
NotNull
(
Record
.
Exception
(
()
=>
Assert
.
NotNull
(
await
Record
.
ExceptionAsync
(
async
()
=>
{
var
testDocument
=
workspace
.
Documents
.
Single
();
var
tree
=
ExtractMethod
(
workspace
,
testDocument
);
var
tree
=
await
ExtractMethodAsync
(
workspace
,
testDocument
);
}));
}
}
...
...
@@ -74,7 +74,7 @@ protected async Task NotSupported_ExtractMethodAsync(string codeWithMarker)
var
testDocument
=
workspace
.
Documents
.
Single
();
var
subjectBuffer
=
testDocument
.
TextBuffer
;
var
tree
=
ExtractMethod
(
workspace
,
testDocument
,
allowMovingDeclaration
:
allowMovingDeclaration
,
dontPutOutOrRefOnStruct
:
dontPutOutOrRefOnStruct
);
var
tree
=
await
ExtractMethodAsync
(
workspace
,
testDocument
,
allowMovingDeclaration
:
allowMovingDeclaration
,
dontPutOutOrRefOnStruct
:
dontPutOutOrRefOnStruct
);
using
(
var
edit
=
subjectBuffer
.
CreateEdit
())
{
...
...
@@ -93,7 +93,7 @@ protected async Task NotSupported_ExtractMethodAsync(string codeWithMarker)
}
}
protected
static
SyntaxNode
ExtractMethod
(
protected
static
async
Task
<
SyntaxNode
>
ExtractMethodAsync
(
TestWorkspace
workspace
,
TestHostDocument
testDocument
,
bool
succeed
=
true
,
...
...
@@ -107,7 +107,7 @@ protected async Task NotSupported_ExtractMethodAsync(string codeWithMarker)
.
WithChangedOption
(
ExtractMethodOptions
.
AllowMovingDeclaration
,
document
.
Project
.
Language
,
allowMovingDeclaration
)
.
WithChangedOption
(
ExtractMethodOptions
.
DontPutOutOrRefOnStruct
,
document
.
Project
.
Language
,
dontPutOutOrRefOnStruct
);
var
semanticDocument
=
SemanticDocument
.
CreateAsync
(
document
,
CancellationToken
.
None
).
Result
;
var
semanticDocument
=
await
SemanticDocument
.
CreateAsync
(
document
,
CancellationToken
.
None
)
;
var
validator
=
new
CSharpSelectionValidator
(
semanticDocument
,
testDocument
.
SelectedSpans
.
Single
(),
options
);
var
selectedCode
=
validator
.
GetValidSelectionAsync
(
CancellationToken
.
None
).
Result
;
...
...
@@ -120,11 +120,11 @@ protected async Task NotSupported_ExtractMethodAsync(string codeWithMarker)
// extract method
var
extractor
=
new
CSharpMethodExtractor
((
CSharpSelectionResult
)
selectedCode
);
var
result
=
extractor
.
ExtractMethodAsync
(
CancellationToken
.
None
).
Result
;
var
result
=
await
extractor
.
ExtractMethodAsync
(
CancellationToken
.
None
)
;
Assert
.
NotNull
(
result
);
Assert
.
Equal
(
succeed
,
result
.
Succeeded
||
result
.
SucceededWithSuggestion
);
return
result
.
Document
.
GetSyntaxRootAsync
().
Result
;
return
await
result
.
Document
.
GetSyntaxRootAsync
()
;
}
protected
async
Task
TestSelectionAsync
(
string
codeWithMarker
,
bool
expectedFail
=
false
,
CSharpParseOptions
parseOptions
=
null
)
...
...
@@ -140,9 +140,9 @@ protected async Task TestSelectionAsync(string codeWithMarker, bool expectedFail
var
options
=
document
.
Project
.
Solution
.
Workspace
.
Options
.
WithChangedOption
(
ExtractMethodOptions
.
AllowMovingDeclaration
,
document
.
Project
.
Language
,
true
);
var
semanticDocument
=
SemanticDocument
.
CreateAsync
(
document
,
CancellationToken
.
None
).
Result
;
var
semanticDocument
=
await
SemanticDocument
.
CreateAsync
(
document
,
CancellationToken
.
None
)
;
var
validator
=
new
CSharpSelectionValidator
(
semanticDocument
,
namedSpans
[
"b"
].
Single
(),
options
);
var
result
=
validator
.
GetValidSelectionAsync
(
CancellationToken
.
None
).
Result
;
var
result
=
await
validator
.
GetValidSelectionAsync
(
CancellationToken
.
None
)
;
Assert
.
True
(
expectedFail
?
result
.
Status
.
Failed
()
:
result
.
Status
.
Succeeded
());
...
...
@@ -160,8 +160,8 @@ protected async Task IterateAllAsync(string code)
var
document
=
workspace
.
CurrentSolution
.
GetDocument
(
workspace
.
Documents
.
First
().
Id
);
Assert
.
NotNull
(
document
);
var
semanticDocument
=
SemanticDocument
.
CreateAsync
(
document
,
CancellationToken
.
None
).
Result
;
var
tree
=
document
.
GetSyntaxTreeAsync
().
Result
;
var
semanticDocument
=
await
SemanticDocument
.
CreateAsync
(
document
,
CancellationToken
.
None
)
;
var
tree
=
await
document
.
GetSyntaxTreeAsync
()
;
var
iterator
=
tree
.
GetRoot
().
DescendantNodesAndSelf
().
Cast
<
SyntaxNode
>();
var
options
=
document
.
Project
.
Solution
.
Workspace
.
Options
...
...
@@ -172,7 +172,7 @@ protected async Task IterateAllAsync(string code)
try
{
var
validator
=
new
CSharpSelectionValidator
(
semanticDocument
,
node
.
Span
,
options
);
var
result
=
validator
.
GetValidSelectionAsync
(
CancellationToken
.
None
).
Result
;
var
result
=
await
validator
.
GetValidSelectionAsync
(
CancellationToken
.
None
)
;
// check the obvious case
if
(!(
node
is
ExpressionSyntax
)
&&
!
node
.
UnderValidContext
())
...
...
src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTestBase.cs
浏览文件 @
52b465d7
...
...
@@ -47,7 +47,7 @@ protected async Task AssertFormatAsync(string expected, string code, bool debugM
buffer
.
CurrentSnapshot
.
GetText
());
var
document
=
workspace
.
CurrentSolution
.
GetDocument
(
hostdoc
.
Id
);
var
syntaxTree
=
document
.
GetSyntaxTreeAsync
().
Result
;
var
syntaxTree
=
await
document
.
GetSyntaxTreeAsync
()
;
var
formattingRuleProvider
=
workspace
.
Services
.
GetService
<
IHostDependentFormattingRuleFactoryService
>();
...
...
@@ -119,7 +119,7 @@ protected async Task AssertFormatAsync(string expected, string code, IEnumerable
var
buffer
=
hostdoc
.
GetTextBuffer
();
var
document
=
workspace
.
CurrentSolution
.
GetDocument
(
hostdoc
.
Id
);
var
syntaxTree
=
document
.
GetSyntaxTreeAsync
().
Result
;
var
syntaxTree
=
await
document
.
GetSyntaxTreeAsync
()
;
// create new buffer with cloned content
var
clonedBuffer
=
EditorFactory
.
CreateBuffer
(
...
...
src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTests.cs
浏览文件 @
52b465d7
...
...
@@ -355,7 +355,7 @@ public void M()
var
spans
=
subjectDocument
.
SelectedSpans
;
var
document
=
workspace
.
CurrentSolution
.
Projects
.
Single
().
Documents
.
Single
();
var
syntaxRoot
=
document
.
GetSyntaxRootAsync
().
Result
;
var
syntaxRoot
=
await
document
.
GetSyntaxRootAsync
()
;
var
node
=
Formatter
.
Format
(
syntaxRoot
,
spans
,
workspace
);
Assert
.
Equal
(
expected
,
node
.
ToFullString
());
...
...
@@ -451,7 +451,7 @@ public void M()
workspace
.
Options
=
workspace
.
Options
.
WithChangedOption
(
FormattingOptions
.
AllowDisjointSpanMerging
,
true
);
var
document
=
workspace
.
CurrentSolution
.
Projects
.
Single
().
Documents
.
Single
();
var
syntaxRoot
=
document
.
GetSyntaxRootAsync
().
Result
;
var
syntaxRoot
=
await
document
.
GetSyntaxRootAsync
()
;
var
node
=
Formatter
.
Format
(
syntaxRoot
,
spans
,
workspace
);
Assert
.
Equal
(
expected
,
node
.
ToFullString
());
...
...
src/EditorFeatures/CSharpTest/Formatting/Indentation/FormatterTestsBase.cs
浏览文件 @
52b465d7
...
...
@@ -60,7 +60,7 @@ public class FormatterTestsBase
private
static
async
Task
TokenFormatWorkerAsync
(
TestWorkspace
workspace
,
ITextBuffer
buffer
,
int
indentationLine
,
char
ch
)
{
Document
document
=
buffer
.
CurrentSnapshot
.
GetRelatedDocumentsWithChanges
().
First
();
var
root
=
(
CompilationUnitSyntax
)
document
.
GetSyntaxRootAsync
().
Result
;
var
root
=
(
CompilationUnitSyntax
)
await
document
.
GetSyntaxRootAsync
()
;
var
line
=
root
.
GetText
().
Lines
[
indentationLine
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录