Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
fc7989f9
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,发现更多精彩内容 >>
未验证
提交
fc7989f9
编写于
11月 28, 2017
作者:
J
Julien Couvreur
提交者:
GitHub
11月 28, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add details to output for IDE test failure (#23298)
上级
a2d0d236
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
77 addition
and
2 deletion
+77
-2
src/EditorFeatures/Test2/FindReferences/FindReferencesTests.vb
...ditorFeatures/Test2/FindReferences/FindReferencesTests.vb
+77
-2
未找到文件。
src/EditorFeatures/Test2/FindReferences/FindReferencesTests.vb
浏览文件 @
fc7989f9
...
...
@@ -7,6 +7,7 @@ Imports Microsoft.CodeAnalysis.Editor.FindUsages
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports
Microsoft.CodeAnalysis.FindSymbols
Imports
Microsoft.CodeAnalysis.FindUsages
Imports
Microsoft.CodeAnalysis.PooledObjects
Imports
Microsoft.CodeAnalysis.Remote
Imports
Microsoft.CodeAnalysis.Test.Utilities.RemoteHost
Imports
Microsoft.CodeAnalysis.Text
...
...
@@ -202,7 +203,13 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences
Dim
documentsWithAnnotatedSpans
=
workspace
.
Documents
.
Where
(
Function
(
d
)
d
.
AnnotatedSpans
.
Any
())
Assert
.
Equal
(
Of
String
)(
documentsWithAnnotatedSpans
.
Select
(
Function
(
d
)
GetFilePathAndProjectLabel
(
workspace
,
d
)).
Order
(),
actualDefinitions
.
Keys
.
Order
())
For
Each
doc
In
documentsWithAnnotatedSpans
Assert
.
Equal
(
Of
Text
.
TextSpan
)(
doc
.
AnnotatedSpans
(
DefinitionKey
).
Order
(),
actualDefinitions
(
GetFilePathAndProjectLabel
(
workspace
,
doc
)).
Order
())
Dim
expected
=
doc
.
AnnotatedSpans
(
DefinitionKey
).
Order
()
Dim
actual
=
actualDefinitions
(
GetFilePathAndProjectLabel
(
workspace
,
doc
)).
Order
()
If
Not
TextSpansMatch
(
expected
,
actual
)
Then
Assert
.
True
(
False
,
PrintSpans
(
expected
,
actual
,
workspace
.
CurrentSolution
.
GetDocument
(
doc
.
Id
),
"{|Definition:"
,
"|}"
))
End
If
Next
Dim
actualReferences
=
...
...
@@ -222,12 +229,80 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences
Dim
expectedSpans
=
doc
.
SelectedSpans
.
Order
()
Dim
actualSpans
=
actualReferences
(
GetFilePathAndProjectLabel
(
workspace
,
doc
)).
Order
()
AssertEx
.
Equal
(
expectedSpans
,
actualSpans
)
AssertEx
.
Equal
(
expectedSpans
,
actualSpans
,
message
:
=
PrintSpans
(
expectedSpans
,
actualSpans
,
workspace
.
CurrentSolution
.
GetDocument
(
doc
.
Id
),
"[|"
,
"|]"
,
messageOnly
:
=
True
))
Next
Next
End
Using
End
Function
Private
Shared
Function
PrintSpans
(
expected
As
IOrderedEnumerable
(
Of
TextSpan
),
actual
As
IOrderedEnumerable
(
Of
TextSpan
),
doc
As
Document
,
prefix
As
String
,
suffix
As
String
,
Optional
messageOnly
As
Boolean
=
False
)
As
String
Debug
.
Assert
(
expected
IsNot
Nothing
)
Debug
.
Assert
(
actual
IsNot
Nothing
)
Dim
instance
=
PooledStringBuilder
.
GetInstance
()
Dim
builder
=
instance
.
Builder
builder
.
AppendLine
()
If
Not
messageOnly
Then
builder
.
AppendLine
(
$
"Expected: {String.Join("
,
", expected.Select(Function(e) e.ToString()))}"
)
builder
.
AppendLine
(
$
"Actual: {String.Join("
,
", actual.Select(Function(a) a.ToString()))}"
)
End
If
Dim
text
As
SourceText
=
Nothing
doc
.
TryGetText
(
text
)
Dim
position
=
0
For
Each
span
In
actual
builder
.
Append
(
text
.
GetSubText
(
New
TextSpan
(
position
,
span
.
Start
-
position
)))
builder
.
Append
(
prefix
)
builder
.
Append
(
text
.
GetSubText
(
span
))
builder
.
Append
(
suffix
)
position
=
span
.
End
Next
builder
.
Append
(
text
.
GetSubText
(
New
TextSpan
(
position
,
text
.
Length
-
position
)))
Return
instance
.
ToStringAndFree
()
End
Function
Private
Shared
Function
TextSpansMatch
(
expected
As
IOrderedEnumerable
(
Of
TextSpan
),
actual
As
IOrderedEnumerable
(
Of
TextSpan
))
As
Boolean
Debug
.
Assert
(
expected
IsNot
Nothing
)
Debug
.
Assert
(
actual
IsNot
Nothing
)
Dim
enumeratorExpected
As
IEnumerator
(
Of
TextSpan
)
=
Nothing
Dim
enumeratorActual
As
IEnumerator
(
Of
TextSpan
)
=
Nothing
Try
enumeratorExpected
=
expected
.
GetEnumerator
()
enumeratorActual
=
actual
.
GetEnumerator
()
While
True
Dim
hasNextExpected
=
enumeratorExpected
.
MoveNext
()
Dim
hasNextActual
=
enumeratorActual
.
MoveNext
()
If
Not
hasNextExpected
OrElse
Not
hasNextActual
Then
Return
hasNextExpected
=
hasNextActual
End
If
If
Not
enumeratorExpected
.
Current
.
Equals
(
enumeratorActual
.
Current
)
Then
Return
False
End
If
End
While
Finally
Dim
asDisposable
=
TryCast
(
enumeratorExpected
,
IDisposable
)
If
asDisposable
IsNot
Nothing
Then
asDisposable
.
Dispose
()
End
If
asDisposable
=
TryCast
(
enumeratorActual
,
IDisposable
)
If
asDisposable
IsNot
Nothing
Then
asDisposable
.
Dispose
()
End
If
End
Try
Return
True
End
Function
Private
Function
IsImplicitNamespace
(
referencedSymbol
As
ReferencedSymbol
)
As
Boolean
Return
referencedSymbol
.
Definition
.
IsImplicitlyDeclared
AndAlso
referencedSymbol
.
Definition
.
Kind
=
SymbolKind
.
Namespace
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录