Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
4941c8a4
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,发现更多精彩内容 >>
提交
4941c8a4
编写于
11月 11, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make more tests async.
上级
916276a4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
17 addition
and
17 deletion
+17
-17
src/EditorFeatures/Test/ChangeSignature/AbstractChangeSignatureTests.cs
...ures/Test/ChangeSignature/AbstractChangeSignatureTests.cs
+1
-1
src/EditorFeatures/Test/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...est/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+7
-7
src/EditorFeatures/Test/Diagnostics/AbstractUserDiagnosticTest.cs
...orFeatures/Test/Diagnostics/AbstractUserDiagnosticTest.cs
+2
-2
src/Features/CSharp/Portable/CodeFixes/Suppression/CSharpSuppressionCodeFixProvider.cs
...CodeFixes/Suppression/CSharpSuppressionCodeFixProvider.cs
+2
-2
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.GlobalSuppressMessageCodeAction.cs
...ressionCodeFixProvider.GlobalSuppressMessageCodeAction.cs
+1
-1
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs
...nCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs
+1
-1
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs
...deFixes/Suppression/AbstractSuppressionCodeFixProvider.cs
+1
-1
src/Features/VisualBasic/Portable/CodeFixes/Suppression/VisualBasicSuppressionCodeFixProvider.vb
...ixes/Suppression/VisualBasicSuppressionCodeFixProvider.vb
+2
-2
未找到文件。
src/EditorFeatures/Test/ChangeSignature/AbstractChangeSignatureTests.cs
浏览文件 @
4941c8a4
...
...
@@ -40,7 +40,7 @@ protected override ParseOptions GetScriptOptions()
optionsService
.
UpdatedSignature
=
updatedSignature
;
var
codeIssueOrRefactoring
=
GetCodeRefactoring
(
workspace
);
TestActions
(
workspace
,
expectedCode
,
index
,
codeIssueOrRefactoring
.
Actions
.
ToList
(),
await
TestActionsAsync
(
workspace
,
expectedCode
,
index
,
codeIssueOrRefactoring
.
Actions
.
ToList
(),
conflictSpans
:
null
,
renameSpans
:
null
,
warningSpans
:
null
,
compareTokens
:
true
);
}
}
...
...
src/EditorFeatures/Test/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
4941c8a4
...
...
@@ -193,7 +193,7 @@ protected async Task<IList<CodeAction>> GetCodeActionsAsync(TestWorkspace worksp
ApplyOptionsToWorkspace
(
workspace
,
options
);
var
actions
=
await
GetCodeActionsAsync
(
workspace
,
fixAllActionEquivalenceKey
);
TestActions
(
await
TestActionsAsync
(
workspace
,
expected
,
index
,
actions
,
conflictSpans
,
renameSpans
,
warningSpans
,
...
...
@@ -201,14 +201,14 @@ protected async Task<IList<CodeAction>> GetCodeActionsAsync(TestWorkspace worksp
}
}
protected
T
uple
<
Solution
,
Solution
>
TestActions
(
protected
T
ask
<
Tuple
<
Solution
,
Solution
>>
TestActionsAsync
(
TestWorkspace
workspace
,
string
expected
,
int
index
,
IList
<
CodeAction
>
actions
,
IList
<
TextSpan
>
conflictSpans
,
IList
<
TextSpan
>
renameSpans
,
IList
<
TextSpan
>
warningSpans
,
bool
compareTokens
)
{
var
operations
=
VerifyInputsAndGetOperations
(
index
,
actions
);
return
TestOperations
(
workspace
,
expected
,
operations
.
ToList
(),
conflictSpans
,
renameSpans
,
warningSpans
,
compareTokens
,
expectedChangedDocumentId
:
null
);
return
TestOperations
Async
(
workspace
,
expected
,
operations
.
ToList
(),
conflictSpans
,
renameSpans
,
warningSpans
,
compareTokens
,
expectedChangedDocumentId
:
null
);
}
private
static
bool
IsWorkspaceElement
(
string
text
)
...
...
@@ -216,7 +216,7 @@ private static bool IsWorkspaceElement(string text)
return
text
.
TrimStart
(
'\r'
,
'\n'
,
' '
).
StartsWith
(
"<Workspace>"
,
StringComparison
.
Ordinal
);
}
protected
Tuple
<
Solution
,
Solution
>
TestOperations
(
protected
async
Task
<
Tuple
<
Solution
,
Solution
>>
TestOperationsAsync
(
TestWorkspace
workspace
,
string
expectedText
,
IList
<
CodeActionOperation
>
operations
,
...
...
@@ -232,7 +232,7 @@ private static bool IsWorkspaceElement(string text)
if
(
IsWorkspaceElement
(
expectedText
))
{
VerifyAgainstWorkspaceDefinition
(
expectedText
,
newSolution
);
await
VerifyAgainstWorkspaceDefinitionAsync
(
expectedText
,
newSolution
);
return
Tuple
.
Create
(
oldSolution
,
newSolution
);
}
...
...
@@ -277,9 +277,9 @@ private static Document GetDocumentToVerify(DocumentId expectedChangedDocumentId
return
document
;
}
private
static
void
VerifyAgainstWorkspaceDefinition
(
string
expectedText
,
Solution
newSolution
)
private
static
async
Task
VerifyAgainstWorkspaceDefinitionAsync
(
string
expectedText
,
Solution
newSolution
)
{
using
(
var
expectedWorkspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
expectedText
))
using
(
var
expectedWorkspace
=
await
TestWorkspaceFactory
.
CreateWorkspaceAsync
(
expectedText
))
{
var
expectedSolution
=
expectedWorkspace
.
CurrentSolution
;
Assert
.
Equal
(
expectedSolution
.
Projects
.
Count
(),
newSolution
.
Projects
.
Count
());
...
...
src/EditorFeatures/Test/Diagnostics/AbstractUserDiagnosticTest.cs
浏览文件 @
4941c8a4
...
...
@@ -401,7 +401,7 @@ protected async Task TestEquivalenceKeyAsync(string initialMarkup, string equiva
if
(!
isNewFile
)
{
oldSolutionAndNewSolution
=
TestOperations
(
oldSolutionAndNewSolution
=
await
TestOperationsAsync
(
testState
.
Workspace
,
expected
,
operations
,
conflictSpans
:
null
,
renameSpans
:
null
,
warningSpans
:
null
,
compareTokens
:
false
,
expectedChangedDocumentId
:
testState
.
ExistingDocument
.
Id
);
...
...
@@ -422,7 +422,7 @@ protected async Task TestEquivalenceKeyAsync(string initialMarkup, string equiva
if
(
checkIfUsingsIncluded
)
{
Assert
.
NotNull
(
expectedTextWithUsings
);
TestOperations
(
testState
.
Workspace
,
expectedTextWithUsings
,
operations
,
await
TestOperationsAsync
(
testState
.
Workspace
,
expectedTextWithUsings
,
operations
,
conflictSpans
:
null
,
renameSpans
:
null
,
warningSpans
:
null
,
compareTokens
:
false
,
expectedChangedDocumentId
:
testState
.
InvocationDocument
.
Id
);
}
...
...
src/Features/CSharp/Portable/CodeFixes/Suppression/CSharpSuppressionCodeFixProvider.cs
浏览文件 @
4941c8a4
...
...
@@ -95,7 +95,7 @@ protected override bool IsEndOfFileToken(SyntaxToken token)
return
token
.
Kind
()
==
SyntaxKind
.
EndOfFileToken
;
}
protected
override
SyntaxNode
AddGlobalSuppressMessageAttribute
(
SyntaxNode
newRoot
,
ISymbol
targetSymbol
,
Diagnostic
diagnostic
,
Workspace
workspace
,
CancellationToken
cancellationToken
)
protected
override
async
Task
<
SyntaxNode
>
AddGlobalSuppressMessageAttributeAsync
(
SyntaxNode
newRoot
,
ISymbol
targetSymbol
,
Diagnostic
diagnostic
,
Workspace
workspace
,
CancellationToken
cancellationToken
)
{
var
compilationRoot
=
(
CompilationUnitSyntax
)
newRoot
;
var
isFirst
=
!
compilationRoot
.
AttributeLists
.
Any
();
...
...
@@ -103,7 +103,7 @@ protected override SyntaxNode AddGlobalSuppressMessageAttribute(SyntaxNode newRo
SyntaxFactory
.
TriviaList
(
SyntaxFactory
.
Comment
(
GlobalSuppressionsFileHeaderComment
))
:
default
(
SyntaxTriviaList
);
var
attributeList
=
CreateAttributeList
(
targetSymbol
,
diagnostic
,
leadingTrivia
:
leadingTriviaForAttributeList
,
needsLeadingEndOfLine
:
!
isFirst
);
attributeList
=
(
AttributeListSyntax
)
Formatter
.
Format
(
attributeList
,
workspace
,
cancellationToken
:
cancellationToken
);
attributeList
=
(
AttributeListSyntax
)
await
Formatter
.
FormatAsync
(
attributeList
,
workspace
,
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
return
compilationRoot
.
AddAttributeLists
(
attributeList
);
}
...
...
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.GlobalSuppressMessageCodeAction.cs
浏览文件 @
4941c8a4
...
...
@@ -26,7 +26,7 @@ protected override async Task<Document> GetChangedSuppressionDocumentAsync(Cance
var
workspace
=
suppressionsDoc
.
Project
.
Solution
.
Workspace
;
var
suppressionsRoot
=
await
suppressionsDoc
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
semanticModel
=
await
suppressionsDoc
.
GetSemanticModelAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
suppressionsRoot
=
Fixer
.
AddGlobalSuppressMessageAttribute
(
suppressionsRoot
,
_targetSymbol
,
_diagnostic
,
workspace
,
cancellationToken
);
suppressionsRoot
=
await
Fixer
.
AddGlobalSuppressMessageAttributeAsync
(
suppressionsRoot
,
_targetSymbol
,
_diagnostic
,
workspace
,
cancellationToken
).
ConfigureAwait
(
false
);
return
suppressionsDoc
.
WithSyntaxRoot
(
suppressionsRoot
);
}
...
...
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs
浏览文件 @
4941c8a4
...
...
@@ -106,7 +106,7 @@ protected override async Task<Document> GetChangedSuppressionDocumentAsync(Cance
foreach
(
var
diagnostic
in
diagnostics
)
{
Contract
.
ThrowIfFalse
(!
diagnostic
.
IsSuppressed
);
suppressionsRoot
=
Fixer
.
AddGlobalSuppressMessageAttribute
(
suppressionsRoot
,
targetSymbol
,
diagnostic
,
workspace
,
cancellationToken
);
suppressionsRoot
=
await
Fixer
.
AddGlobalSuppressMessageAttributeAsync
(
suppressionsRoot
,
targetSymbol
,
diagnostic
,
workspace
,
cancellationToken
).
ConfigureAwait
(
false
);
}
}
...
...
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs
浏览文件 @
4941c8a4
...
...
@@ -42,7 +42,7 @@ public bool CanBeSuppressedOrUnsuppressed(Diagnostic diagnostic)
protected
abstract
Task
<
SyntaxTriviaList
>
CreatePragmaDisableDirectiveTriviaAsync
(
Diagnostic
diagnostic
,
Func
<
SyntaxNode
,
Task
<
SyntaxNode
>>
formatNode
,
bool
needsLeadingEndOfLine
,
bool
needsTrailingEndOfLine
);
protected
abstract
Task
<
SyntaxTriviaList
>
CreatePragmaRestoreDirectiveTriviaAsync
(
Diagnostic
diagnostic
,
Func
<
SyntaxNode
,
Task
<
SyntaxNode
>>
formatNode
,
bool
needsLeadingEndOfLine
,
bool
needsTrailingEndOfLine
);
protected
abstract
SyntaxNode
AddGlobalSuppressMessageAttribute
(
SyntaxNode
newRoot
,
ISymbol
targetSymbol
,
Diagnostic
diagnostic
,
Workspace
workspace
,
CancellationToken
cancellationToken
);
protected
abstract
Task
<
SyntaxNode
>
AddGlobalSuppressMessageAttributeAsync
(
SyntaxNode
newRoot
,
ISymbol
targetSymbol
,
Diagnostic
diagnostic
,
Workspace
workspace
,
CancellationToken
cancellationToken
);
protected
abstract
string
DefaultFileExtension
{
get
;
}
protected
abstract
string
SingleLineCommentStart
{
get
;
}
...
...
src/Features/VisualBasic/Portable/CodeFixes/Suppression/VisualBasicSuppressionCodeFixProvider.vb
浏览文件 @
4941c8a4
...
...
@@ -119,7 +119,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Suppression
Return
token
.
Kind
=
SyntaxKind
.
EndOfFileToken
End
Function
Protected
Overrides
Function
AddGlobalSuppressMessageAttribute
(
newRoot
As
SyntaxNode
,
targetSymbol
As
ISymbol
,
diagnostic
As
Diagnostic
,
workspace
As
Workspace
,
cancellationToken
As
CancellationToken
)
As
SyntaxNode
Protected
Overrides
Async
Function
AddGlobalSuppressMessageAttributeAsync
(
newRoot
As
SyntaxNode
,
targetSymbol
As
ISymbol
,
diagnostic
As
Diagnostic
,
workspace
As
Workspace
,
cancellationToken
As
CancellationToken
)
As
Task
(
Of
SyntaxNode
)
Dim
compilationRoot
=
DirectCast
(
newRoot
,
CompilationUnitSyntax
)
Dim
isFirst
=
Not
compilationRoot
.
Attributes
.
Any
()
Dim
attributeList
=
CreateAttributeList
(
targetSymbol
,
diagnostic
)
...
...
@@ -130,7 +130,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Suppression
attributeStatement
=
attributeStatement
.
WithLeadingTrivia
(
attributeStatement
.
GetLeadingTrivia
.
Add
(
SyntaxFactory
.
ElasticCarriageReturnLineFeed
))
End
If
attributeStatement
=
CType
(
Formatter
.
Format
(
attributeStatement
,
workspace
,
cancellationToken
:
=
cancellationToken
),
AttributesStatementSyntax
)
attributeStatement
=
CType
(
Await
Formatter
.
FormatAsync
(
attributeStatement
,
workspace
,
cancellationToken
:
=
cancellationToken
).
ConfigureAwait
(
False
),
AttributesStatementSyntax
)
Dim
leadingTrivia
=
If
(
isFirst
AndAlso
Not
compilationRoot
.
HasLeadingTrivia
,
SyntaxFactory
.
TriviaList
(
SyntaxFactory
.
CommentTrivia
(
GlobalSuppressionsFileHeaderComment
)),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录