Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET
Roslyn
提交
27095595
R
Roslyn
项目概览
dotNET
/
Roslyn
通知
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,发现更多精彩内容 >>
提交
27095595
编写于
5月 22, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update tests.
上级
2b28e5c1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
64 addition
and
64 deletion
+64
-64
src/VisualStudio/Core/Test/LanguageBlockTests.vb
src/VisualStudio/Core/Test/LanguageBlockTests.vb
+64
-64
未找到文件。
src/VisualStudio/Core/Test/LanguageBlockTests.vb
浏览文件 @
27095595
...
...
@@ -11,8 +11,8 @@ Imports Roslyn.Test.Utilities
Namespace
Tests
Public
Class
LanguageBlockTests
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_NotInImports_VB
()
As
Task
Await
VerifyNoBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_NotInImports_VB
()
VerifyNoBlock
(
"
I$$mports System
Module Program
...
...
@@ -21,11 +21,11 @@ Module Program
End Sub
End Module
"
,
LanguageNames
.
VisualBasic
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_NotLeadingTriviaOfRootClass_VB
()
As
Task
Await
VerifyNoBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_NotLeadingTriviaOfRootClass_VB
()
VerifyNoBlock
(
"
Imports System
$$
...
...
@@ -36,11 +36,11 @@ Module Program
End Sub
End Module
"
,
LanguageNames
.
VisualBasic
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InNamespace_VB
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InNamespace_VB
()
VerifyBlock
(
"
[|Namespace N
$$
Module Program
...
...
@@ -50,11 +50,11 @@ $$
End Module
End Namespace|]
"
,
LanguageNames
.
VisualBasic
,
"N"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InModule_VB
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InModule_VB
()
VerifyBlock
(
"
Namespace N
[|Module Program
$$
...
...
@@ -64,11 +64,11 @@ Namespace N
End Module|]
End Namespace
"
,
LanguageNames
.
VisualBasic
,
"Program"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InSub
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InSub
()
VerifyBlock
(
"
Namespace N
Module Program
[|Sub M()
...
...
@@ -77,11 +77,11 @@ Namespace N
End Module
End Namespace
"
,
LanguageNames
.
VisualBasic
,
"Sub Program.M()"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InFunction
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InFunction
()
VerifyBlock
(
"
Namespace N
Module Program
[|Function F() As Integer
...
...
@@ -90,11 +90,11 @@ Namespace N
End Module
End Namespace
"
,
LanguageNames
.
VisualBasic
,
"Function Program.F() As Integer"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InProperty_VB
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InProperty_VB
()
VerifyBlock
(
"
Namespace N
Module Program
[|ReadOnly Property P() As Integer
...
...
@@ -105,11 +105,11 @@ Namespace N
End Module
End Namespace
"
,
LanguageNames
.
VisualBasic
,
"Property Program.P() As Integer"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_NotInUsings_CS
()
As
Task
Await
VerifyNoBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_NotInUsings_CS
()
VerifyNoBlock
(
"
u$$sing System;
class Program
...
...
@@ -117,11 +117,11 @@ class Program
void M() { }
}
"
,
LanguageNames
.
CSharp
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_NotLeadingTriviaOfRootClass_CS
()
As
Task
Await
VerifyNoBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_NotLeadingTriviaOfRootClass_CS
()
VerifyNoBlock
(
"
using System;
$$
...
...
@@ -131,11 +131,11 @@ class Program
void M() { }
}
"
,
LanguageNames
.
CSharp
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InNamespace_CS
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InNamespace_CS
()
VerifyBlock
(
"
[|namespace N
{
$$
...
...
@@ -145,11 +145,11 @@ $$
}
}|]
"
,
LanguageNames
.
CSharp
,
"N"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InClass_CS
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InClass_CS
()
VerifyBlock
(
"
namespace N
{
[|class Program
...
...
@@ -159,11 +159,11 @@ namespace N
}|]
}
"
,
LanguageNames
.
CSharp
,
"Program"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InMethod
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InMethod
()
VerifyBlock
(
"
namespace N
{
class Program
...
...
@@ -175,11 +175,11 @@ namespace N
}
}
"
,
LanguageNames
.
CSharp
,
"void Program.M()"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_InProperty_CS
()
As
Task
Await
VerifyBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_InProperty_CS
()
VerifyBlock
(
"
namespace N
{
class Program
...
...
@@ -194,43 +194,43 @@ namespace N
}
}
"
,
LanguageNames
.
CSharp
,
"int Program.P"
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
),
WorkItem
(
1043580
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1043580"
)
>
Public
Async
Function
TestGetCurrentBlock_DocumentDoesNotSupportSyntax
()
As
Task
Public
Sub
TestGetCurrentBlock_DocumentDoesNotSupportSyntax
()
' NoCompilation is the special Language-Name we use to indicate that a language does not
' support SyntaxTrees/SemanticModels. This test validates that we do not crash in that
' case and we gracefully bail out with 'false' for VsLanguageBlock.GetCurrentBlock.
Await
VerifyNoBlockAsync
(
"$$"
,
languageName
:
=
"NoCompilation"
)
End
Function
VerifyNoBlock
(
"$$"
,
languageName
:
=
"NoCompilation"
)
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
)
>
Public
Async
Function
TestGetCurrentBlock_NotInGlobalCode_CS
()
As
Task
Await
VerifyNoBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_NotInGlobalCode_CS
()
VerifyNoBlock
(
"
var message =
""
Hello
""
;
System.Console$$.WriteLine(message);
"
,
LanguageNames
.
CSharp
,
SourceCodeKind
.
Script
)
Await
VerifyNoBlockAsync
(
"
VerifyNoBlock
(
"
var message =
""
Hello
""
;
System.Console$$.WriteLine(message);
"
,
LanguageNames
.
CSharp
,
SourceCodeKind
.
Regular
)
End
Function
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
VsLanguageBlock
)
>
Public
Async
Function
TestGetCurrentBlock_NotInGlobalCode_VB
()
As
Task
Await
VerifyNoBlockAsync
(
"
Public
Sub
TestGetCurrentBlock_NotInGlobalCode_VB
()
VerifyNoBlock
(
"
Dim message =
""
Hello
""
System.Console$$.WriteLine(message)
"
,
LanguageNames
.
VisualBasic
,
SourceCodeKind
.
Script
)
Await
VerifyNoBlockAsync
(
"
VerifyNoBlock
(
"
Dim message =
""
Hello
""
System.Console$$.WriteLine(message)
"
,
LanguageNames
.
VisualBasic
,
SourceCodeKind
.
Regular
)
End
Function
End
Sub
Private
Async
Function
VerifyNoBlockAsync
(
markup
As
String
,
languageName
As
String
,
Optional
sourceCodeKind
As
SourceCodeKind
=
SourceCodeKind
.
Regular
)
As
Tasks
.
Task
Private
Sub
VerifyNoBlock
(
markup
As
String
,
languageName
As
String
,
Optional
sourceCodeKind
As
SourceCodeKind
=
SourceCodeKind
.
Regular
)
Dim
xml
=
<
Workspace
>
<
Project
Language
=<
%
=
languageName
%
>
CommonReferences
=
"True"
>
<
Document
>
...
...
@@ -242,14 +242,14 @@ System.Console$$.WriteLine(message)
Using
workspace
=
TestWorkspace
.
Create
(
xml
)
Dim
hostDocument
=
workspace
.
Documents
.
Single
()
Assert
.
Null
(
Await
VsLanguageBlock
.
GetCurrentBlockAsync
(
hostDocument
.
TextBuffer
.
CurrentSnapshot
,
hostDocument
.
CursorPosition
.
Value
,
CancellationToken
.
None
))
Assert
.
Null
(
VsLanguageBlock
.
GetCurrentBlock
(
hostDocument
.
TextBuffer
.
CurrentSnapshot
,
hostDocument
.
CursorPosition
.
Value
,
CancellationToken
.
None
))
End
Using
End
Function
End
Sub
Private
Async
Function
VerifyBlockAsync
(
markup
As
String
,
languageName
As
String
,
expectedDescription
As
String
)
As
Tasks
.
Task
Private
Sub
VerifyBlock
(
markup
As
String
,
languageName
As
String
,
expectedDescription
As
String
)
Dim
xml
=
<
Workspace
>
<
Project
Language
=<
%
=
languageName
%
>
CommonReferences
=
"True"
>
<
Document
>
...
...
@@ -260,14 +260,14 @@ System.Console$$.WriteLine(message)
Using
workspace
=
TestWorkspace
.
Create
(
xml
)
Dim
hostDocument
=
workspace
.
Documents
.
Single
()
Dim
tuple
=
Await
VsLanguageBlock
.
GetCurrentBlockAsync
(
hostDocument
.
TextBuffer
.
CurrentSnapshot
,
hostDocument
.
CursorPosition
.
Value
,
CancellationToken
.
None
)
Dim
tuple
=
VsLanguageBlock
.
GetCurrentBlock
(
hostDocument
.
TextBuffer
.
CurrentSnapshot
,
hostDocument
.
CursorPosition
.
Value
,
CancellationToken
.
None
)
Assert
.
Equal
(
expectedDescription
,
tuple
.
Item1
)
Assert
.
Equal
(
hostDocument
.
SelectedSpans
.
Single
(),
tuple
.
Item2
)
Assert
.
Equal
(
expectedDescription
,
tuple
.
Value
.
description
)
Assert
.
Equal
(
hostDocument
.
SelectedSpans
.
Single
(),
tuple
.
Value
.
span
)
End
Using
End
Function
End
Sub
End
Class
End
Namespace
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录