Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6ac1682e
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,发现更多精彩内容 >>
提交
6ac1682e
编写于
11月 11, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make classification tests Async.
上级
e0429f0e
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
757 addition
and
757 deletion
+757
-757
src/EditorFeatures/VisualBasicTest/Classification/AbstractVisualBasicClassifierTests.vb
...Test/Classification/AbstractVisualBasicClassifierTests.vb
+53
-53
src/EditorFeatures/VisualBasicTest/Classification/SemanticClassifierTests.vb
...VisualBasicTest/Classification/SemanticClassifierTests.vb
+128
-128
src/EditorFeatures/VisualBasicTest/Classification/SyntacticClassifierTests.vb
...isualBasicTest/Classification/SyntacticClassifierTests.vb
+576
-576
未找到文件。
src/EditorFeatures/VisualBasicTest/Classification/AbstractVisualBasicClassifierTests.vb
浏览文件 @
6ac1682e
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports
System.Threading.Tasks
Imports
Microsoft.CodeAnalysis.Classification
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.Classification
Imports
Microsoft.CodeAnalysis.Text
...
...
@@ -64,7 +65,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Classification
Return
ClassificationBuilder
.
VBXmlEntityReference
(
value
)
End
Function
Friend
MustOverride
Function
GetClassificationSpans
(
code
As
String
,
textSpan
As
TextSpan
)
As
IEnumerable
(
Of
ClassifiedSpan
)
Friend
MustOverride
Function
GetClassificationSpans
Async
(
code
As
String
,
textSpan
As
TextSpan
)
As
Task
(
Of
IEnumerable
(
Of
ClassifiedSpan
)
)
Protected
Function
GetText
(
tuple
As
Tuple
(
Of
String
,
String
))
As
String
Return
"("
&
tuple
.
Item1
&
", "
&
tuple
.
Item2
&
")"
...
...
@@ -78,31 +79,31 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Classification
Return
"("
&
tuple
.
Item1
.
ToString
()
&
", "
&
tuple
.
Item2
.
Classification
&
")"
End
Function
Protected
Sub
Test
(
Protected
Function
TestAsync
(
code
As
String
,
allCode
As
String
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Dim
start
=
allCode
.
IndexOf
(
code
,
StringComparison
.
Ordinal
)
Dim
length
=
code
.
Length
Dim
span
=
New
TextSpan
(
start
,
length
)
Test
(
code
,
allCode
,
span
,
expected
)
End
Sub
Return
TestAsync
(
code
,
allCode
,
span
,
expected
)
End
Function
Protected
Sub
Test
(
code
As
String
,
span
As
TextSpan
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
Test
(
code
,
code
,
span
,
expected
)
End
Sub
Protected
Function
TestAsync
(
code
As
String
,
span
As
TextSpan
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Return
TestAsync
(
code
,
code
,
span
,
expected
)
End
Function
Protected
Sub
Test
(
Protected
Async
Function
TestAsync
(
code
As
String
,
allCode
As
String
,
span
As
TextSpan
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Dim
actual
=
GetClassificationSpans
(
allCode
,
span
).
ToList
()
Dim
actual
=
(
Await
GetClassificationSpansAsync
(
allCode
,
span
)
).
ToList
()
actual
.
Sort
(
Function
(
t1
,
t2
)
t1
.
TextSpan
.
Start
-
t2
.
TextSpan
.
Start
)
For
i
=
0
To
Math
.
Max
(
expected
.
Length
,
actual
.
Count
)
-
1
...
...
@@ -119,100 +120,99 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Classification
Assert
.
Equal
(
tuple
.
Item1
,
text
)
Assert
.
Equal
(
tuple
.
Item2
,
classification
.
ClassificationType
)
Next
End
Sub
End
Function
Protected
Function
Classifications
(
ParamArray
expected
As
Tuple
(
Of
String
,
IClassificationType
)())
As
Tuple
(
Of
String
,
IClassificationType
)()
Return
expected
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
Test
(
Protected
Function
TestAsync
(
code
As
String
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Test
(
code
,
code
,
expected
)
End
Sub
Return
TestAsync
(
code
,
code
,
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInNamespace
(
Protected
Function
TestInNamespaceAsync
(
code
As
String
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Dim
allCode
=
"Namespace N"
&
vbCrLf
&
code
&
vbCrLf
&
"End Namespace"
Test
(
code
,
allCode
,
expected
)
End
Sub
Return
TestAsync
(
code
,
allCode
,
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInClass
(
Protected
Function
TestInClassAsync
(
className
As
String
,
code
As
String
,
expected
As
Tuple
(
Of
String
,
String
)())
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Dim
allCode
=
"Class "
&
className
&
vbCrLf
&
code
&
vbCrLf
&
"End Class"
Test
(
code
,
allCode
,
expected
)
End
Sub
Return
TestAsync
(
code
,
allCode
,
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInClass
(
Protected
Function
TestInClassAsync
(
code
As
String
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
TestInClass
(
"C"
,
code
,
expected
)
End
Sub
Return
TestInClassAsync
(
"C"
,
code
,
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInMethod
(
Protected
Function
TestInMethodAsync
(
className
As
String
,
methodName
As
String
,
code
As
String
,
expected
As
Tuple
(
Of
String
,
String
)())
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Dim
allCode
=
"Class "
&
className
&
vbCrLf
&
" Sub "
&
methodName
&
"()"
&
vbCrLf
&
" "
&
code
&
vbCrLf
&
" End Sub"
&
vbCrLf
&
"End Class"
Test
(
code
,
allCode
,
expected
)
End
Sub
Return
TestAsync
(
code
,
allCode
,
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInMethod
(
Protected
Async
Function
TestInMethodAsync
(
className
As
String
,
methodName
As
String
,
code
As
String
,
codeToClassify
As
String
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Dim
allCode
=
"Class "
&
className
&
vbCrLf
&
" Sub "
&
methodName
&
"()"
&
vbCrLf
&
" "
&
code
&
vbCrLf
&
" End Sub"
&
vbCrLf
&
"End Class"
Dim
start
=
allCode
.
IndexOf
(
codeToClassify
)
Dim
length
=
codeToClassify
.
Length
Test
(
code
,
allCode
,
n
ew
TextSpan
(
start
,
length
),
expected
)
End
Sub
Await
TestAsync
(
code
,
allCode
,
N
ew
TextSpan
(
start
,
length
),
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInMethod
(
Protected
Function
TestInMethodAsync
(
methodName
As
String
,
code
As
String
,
expected
As
Tuple
(
Of
String
,
String
)())
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
TestInMethod
(
"C"
,
methodName
,
code
,
expected
)
End
Sub
Return
TestInMethodAsync
(
"C"
,
methodName
,
code
,
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInMethod
(
Protected
Function
TestInMethodAsync
(
code
As
String
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
TestInMethod
(
"C"
,
"M"
,
code
,
expected
)
End
Sub
Return
TestInMethodAsync
(
"C"
,
"M"
,
code
,
expected
)
End
Function
<
DebuggerStepThrough
()
>
Protected
Sub
TestInExpression
(
Protected
Function
TestInExpressionAsync
(
code
As
String
,
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
ParamArray
expected
As
Tuple
(
Of
String
,
String
)())
As
Task
Dim
allCode
=
"Class C"
&
vbCrLf
&
" Sub M()"
&
vbCrLf
&
" dim q = "
&
code
&
vbCrLf
&
" End Sub"
&
vbCrLf
&
"End Class"
Test
(
code
,
allCode
,
expected
)
End
Sub
Return
TestAsync
(
code
,
allCode
,
expected
)
End
Function
End
Class
End
Namespace
End
Namespace
\ No newline at end of file
src/EditorFeatures/VisualBasicTest/Classification/SemanticClassifierTests.vb
浏览文件 @
6ac1682e
此差异已折叠。
点击以展开。
src/EditorFeatures/VisualBasicTest/Classification/SyntacticClassifierTests.vb
浏览文件 @
6ac1682e
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录