Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2668181f
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,体验更适合开发者的 AI 搜索 >>
提交
2668181f
编写于
11月 20, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make less blocking calls in tests.
上级
4dd79d38
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
23 deletion
+23
-23
src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
...itorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
+2
-2
src/EditorFeatures/Test/TypeInferrer/TypeInferrerTestBase.cs
src/EditorFeatures/Test/TypeInferrer/TypeInferrerTestBase.cs
+3
-3
src/EditorFeatures/VisualBasicTest/Outlining/MetadataAsSource/InvalidIdentifierTests.vb
...Test/Outlining/MetadataAsSource/InvalidIdentifierTests.vb
+1
-1
src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb
...VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb
+10
-10
src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
...eatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
+5
-5
src/EditorFeatures/VisualBasicTest/VisualBasicGoToAdjacentMemberTests.vb
...res/VisualBasicTest/VisualBasicGoToAdjacentMemberTests.vb
+2
-2
未找到文件。
src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
浏览文件 @
2668181f
...
...
@@ -20,9 +20,9 @@ public TypeInferrerTests(CSharpTestWorkspaceFixture workspaceFixture) : base(wor
{
}
protected
override
void
TestWorker
(
Document
document
,
TextSpan
textSpan
,
string
expectedType
,
bool
useNodeStartPosition
)
protected
override
async
Task
TestWorkerAsync
(
Document
document
,
TextSpan
textSpan
,
string
expectedType
,
bool
useNodeStartPosition
)
{
var
root
=
document
.
GetSyntaxTreeAsync
().
Result
.
GetRoot
();
var
root
=
(
await
document
.
GetSyntaxTreeAsync
())
.
GetRoot
();
var
node
=
FindExpressionSyntaxFromSpan
(
root
,
textSpan
);
var
typeInference
=
document
.
GetLanguageService
<
ITypeInferenceService
>();
...
...
src/EditorFeatures/Test/TypeInferrer/TypeInferrerTestBase.cs
浏览文件 @
2668181f
...
...
@@ -57,15 +57,15 @@ protected async Task TestAsync(string text, string expectedType, bool testNode =
bool
useNodeStartPosition
)
{
var
document
=
await
fixture
.
UpdateDocumentAsync
(
text
,
SourceCodeKind
.
Regular
);
TestWorker
(
document
,
textSpan
,
expectedType
,
useNodeStartPosition
);
await
TestWorkerAsync
(
document
,
textSpan
,
expectedType
,
useNodeStartPosition
);
if
(
CanUseSpeculativeSemanticModel
(
document
,
textSpan
.
Start
))
{
var
document2
=
await
fixture
.
UpdateDocumentAsync
(
text
,
SourceCodeKind
.
Regular
,
cleanBeforeUpdate
:
false
);
TestWorker
(
document2
,
textSpan
,
expectedType
,
useNodeStartPosition
);
await
TestWorkerAsync
(
document2
,
textSpan
,
expectedType
,
useNodeStartPosition
);
}
}
protected
abstract
void
TestWorker
(
Document
document
,
TextSpan
textSpan
,
string
expectedType
,
bool
useNodeStartPosition
);
protected
abstract
Task
TestWorkerAsync
(
Document
document
,
TextSpan
textSpan
,
string
expectedType
,
bool
useNodeStartPosition
);
}
}
src/EditorFeatures/VisualBasicTest/Outlining/MetadataAsSource/InvalidIdentifierTests.vb
浏览文件 @
2668181f
...
...
@@ -16,7 +16,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining.Metadata
Dim
workspace
=
Await
TestWorkspaceFactory
.
CreateWorkspaceFromFilesAsync
(
WorkspaceKind
.
MetadataAsSource
,
LanguageNames
.
VisualBasic
,
Nothing
,
Nothing
,
fileContents
)
Dim
outliningService
=
workspace
.
Services
.
GetLanguageServices
(
LanguageNames
.
VisualBasic
).
GetService
(
Of
IOutliningService
)()
Dim
document
=
workspace
.
CurrentSolution
.
Projects
.
Single
().
Documents
.
Single
()
Dim
actualOutliningSpans
=
outliningService
.
GetOutliningSpansAsync
(
document
,
CancellationToken
.
None
).
Result
.
Where
(
Function
(
s
)
s
IsNot
Nothing
).
ToArray
()
Dim
actualOutliningSpans
=
(
Await
outliningService
.
GetOutliningSpansAsync
(
document
,
CancellationToken
.
None
))
.
Where
(
Function
(
s
)
s
IsNot
Nothing
).
ToArray
()
Assert
.
Equal
(
expectedSpans
.
Length
,
actualOutliningSpans
.
Length
)
For
i
As
Integer
=
0
To
expectedSpans
.
Length
-
1
...
...
src/EditorFeatures/VisualBasicTest/QuickInfo/SemanticQuickInfoSourceTests.vb
浏览文件 @
2668181f
...
...
@@ -22,7 +22,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo
Return
TestWithReferencesAsync
(
markup
,
Array
.
Empty
(
Of
String
)(),
expectedResults
)
End
Function
Protected
Sub
TestShared
(
workspace
As
TestWorkspace
,
position
As
Integer
,
ParamArray
expectedResults
()
As
Action
(
Of
Object
))
Protected
Async
Function
TestSharedAsync
(
workspace
As
TestWorkspace
,
position
As
Integer
,
ParamArray
expectedResults
()
As
Action
(
Of
Object
))
As
Task
Dim
noListeners
=
SpecializedCollections
.
EmptyEnumerable
(
Of
Lazy
(
Of
IAsynchronousOperationListener
,
FeatureMetadata
))()
Dim
provider
=
New
SemanticQuickInfoProvider
(
...
...
@@ -34,7 +34,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo
workspace
.
GetService
(
Of
IGlyphService
),
workspace
.
GetService
(
Of
ClassificationTypeMap
))
TestShared
(
workspace
,
provider
,
position
,
expectedResults
)
Await
TestSharedAsync
(
workspace
,
provider
,
position
,
expectedResults
)
' speculative semantic model
Dim
document
=
workspace
.
CurrentSolution
.
Projects
.
First
().
Documents
.
First
()
...
...
@@ -45,13 +45,13 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo
edit
.
Apply
()
End
Using
TestShared
(
workspace
,
provider
,
position
,
expectedResults
)
Await
TestSharedAsync
(
workspace
,
provider
,
position
,
expectedResults
)
End
If
End
Sub
End
Function
Private
Sub
TestShared
(
workspace
As
TestWorkspace
,
provider
As
SemanticQuickInfoProvider
,
position
As
Integer
,
expectedResults
()
As
Action
(
Of
Object
))
Dim
state
=
provider
.
GetItemAsync
(
workspace
.
CurrentSolution
.
Projects
.
First
().
Documents
.
First
(),
position
,
cancellationToken
:
=
CancellationToken
.
None
)
.
Result
Private
Async
Function
TestSharedAsync
(
workspace
As
TestWorkspace
,
provider
As
SemanticQuickInfoProvider
,
position
As
Integer
,
expectedResults
()
As
Action
(
Of
Object
))
As
Task
Dim
state
=
Await
provider
.
GetItemAsync
(
workspace
.
CurrentSolution
.
Projects
.
First
().
Documents
.
First
(),
position
,
cancellationToken
:
=
CancellationToken
.
None
)
If
state
IsNot
Nothing
Then
WaitForDocumentationComment
(
state
.
Content
)
...
...
@@ -66,11 +66,11 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo
expected
(
state
.
Content
)
Next
End
If
End
Sub
End
Function
Protected
Async
Function
TestFromXmlAsync
(
markup
As
String
,
ParamArray
expectedResults
As
Action
(
Of
Object
)())
As
Task
Using
workspace
=
Await
VisualBasicWorkspaceFactory
.
CreateWorkspaceAsync
(
markup
)
TestShared
(
workspace
,
workspace
.
Documents
.
First
().
CursorPosition
.
Value
,
expectedResults
)
Await
TestSharedAsync
(
workspace
,
workspace
.
Documents
.
First
().
CursorPosition
.
Value
,
expectedResults
)
End
Using
End
Function
...
...
@@ -80,7 +80,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo
MarkupTestFile
.
GetPosition
(
markup
,
code
,
position
)
Using
workspace
=
Await
VisualBasicWorkspaceFactory
.
CreateWorkspaceFromLinesAsync
({
code
},
Nothing
,
metadataReferences
)
TestShared
(
workspace
,
position
,
expectedResults
)
Await
TestSharedAsync
(
workspace
,
position
,
expectedResults
)
End
Using
End
Function
...
...
src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
浏览文件 @
2668181f
...
...
@@ -18,18 +18,18 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.TypeInferrer
MyBase
.
New
(
workspaceFixture
)
End
Sub
Protected
Overrides
Sub
TestWorker
(
document
As
Document
,
textSpan
As
TextSpan
,
expectedType
As
String
,
useNodeStartPosition
As
Boolean
)
Dim
root
=
document
.
GetSyntaxTreeAsync
().
Result
.
GetRoot
()
Protected
Overrides
Async
Function
TestWorkerAsync
(
document
As
Document
,
textSpan
As
TextSpan
,
expectedType
As
String
,
useNodeStartPosition
As
Boolean
)
As
Task
Dim
root
=
(
Await
document
.
GetSyntaxTreeAsync
())
.
GetRoot
()
Dim
node
=
FindExpressionSyntaxFromSpan
(
root
,
textSpan
)
Dim
typeInference
=
document
.
GetLanguageService
(
Of
ITypeInferenceService
)()
Dim
inferredType
=
If
(
useNodeStartPosition
,
typeInference
.
InferType
(
document
.
GetSemanticModelForSpanAsync
(
New
TextSpan
(
node
.
SpanStart
,
0
),
CancellationToken
.
None
).
Result
,
node
.
SpanStart
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
),
typeInference
.
InferType
(
document
.
GetSemanticModelForSpanAsync
(
node
.
Span
,
CancellationToken
.
None
).
Result
,
node
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
))
typeInference
.
InferType
(
Await
document
.
GetSemanticModelForSpanAsync
(
New
TextSpan
(
node
.
SpanStart
,
0
),
CancellationToken
.
None
)
,
node
.
SpanStart
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
),
typeInference
.
InferType
(
Await
document
.
GetSemanticModelForSpanAsync
(
node
.
Span
,
CancellationToken
.
None
)
,
node
,
objectAsDefault
:
=
True
,
cancellationToken
:
=
CancellationToken
.
None
))
Dim
typeSyntax
=
inferredType
.
GenerateTypeSyntax
().
NormalizeWhitespace
()
Assert
.
Equal
(
expectedType
,
typeSyntax
.
ToString
())
End
Sub
End
Function
Private
Async
Function
TestInClassAsync
(
text
As
String
,
expectedType
As
String
)
As
Tasks
.
Task
text
=
<
text
>
Class
C
...
...
src/EditorFeatures/VisualBasicTest/VisualBasicGoToAdjacentMemberTests.vb
浏览文件 @
2668181f
...
...
@@ -466,7 +466,7 @@ End Sub"
code
)
Dim
hostDocument
=
workspace
.
DocumentWithCursor
Dim
document
As
Document
=
workspace
.
CurrentSolution
.
GetDocument
(
hostDocument
.
Id
)
Assert
.
Empty
(
document
.
GetSyntaxTreeAsync
().
Result
.
GetDiagnostics
())
Assert
.
Empty
(
(
Await
document
.
GetSyntaxTreeAsync
())
.
GetDiagnostics
())
Dim
targetPosition
=
Await
GoToAdjacentMemberCommandHandler
.
GetTargetPositionAsync
(
document
,
hostDocument
.
CursorPosition
.
Value
,
...
...
@@ -487,7 +487,7 @@ End Sub"
code
)
Dim
hostDocument
=
workspace
.
DocumentWithCursor
Dim
document
As
Document
=
workspace
.
CurrentSolution
.
GetDocument
(
hostDocument
.
Id
)
Assert
.
Empty
(
document
.
GetSyntaxTreeAsync
().
Result
.
GetDiagnostics
())
Assert
.
Empty
(
(
Await
document
.
GetSyntaxTreeAsync
())
.
GetDiagnostics
())
Return
Await
GoToAdjacentMemberCommandHandler
.
GetTargetPositionAsync
(
document
,
hostDocument
.
CursorPosition
.
Value
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录