Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ee1b289d
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,发现更多精彩内容 >>
提交
ee1b289d
编写于
10月 09, 2018
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move the new flag into TestParameters and also fix VB RemoveUnusedMembersTests
上级
c606a541
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
81 addition
and
75 deletion
+81
-75
src/EditorFeatures/CSharpTest/RemoveUnusedMembers/RemoveUnusedMembersTests.cs
...SharpTest/RemoveUnusedMembers/RemoveUnusedMembersTests.cs
+1
-1
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...ies/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+7
-4
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionTest.cs
...tures/TestUtilities/CodeActions/AbstractCodeActionTest.cs
+1
-1
src/EditorFeatures/TestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
...tics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
+2
-2
src/EditorFeatures/TestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs
...tilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs
+1
-1
src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
...s/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
+8
-9
src/EditorFeatures/VisualBasicTest/RemoveUnusedMembers/RemoveUnusedMembersTests.vb
...BasicTest/RemoveUnusedMembers/RemoveUnusedMembersTests.vb
+58
-54
src/EditorFeatures/VisualBasicTest/SimplifyTypeNames/SimplifyTypeNamesTests.vb
...sualBasicTest/SimplifyTypeNames/SimplifyTypeNamesTests.vb
+3
-3
未找到文件。
src/EditorFeatures/CSharpTest/RemoveUnusedMembers/RemoveUnusedMembersTests.cs
浏览文件 @
ee1b289d
...
...
@@ -19,7 +19,7 @@ internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProvider
// Ensure that we explicitly test missing IDE0052, which has no corresponding code fix (non-fixable diagnostic).
private
Task
TestDiagnosticMissingAsync
(
string
initialMarkup
)
=>
TestDiagnosticMissingAsync
(
initialMarkup
,
fixableDiagnosticsOnly
:
false
);
=>
TestDiagnosticMissingAsync
(
initialMarkup
,
new
TestParameters
(
fixableDiagnosticsOnly
:
false
)
);
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)]
[
InlineData
(
"public"
)]
...
...
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
ee1b289d
...
...
@@ -36,6 +36,7 @@ public struct TestParameters
internal
readonly
CompilationOptions
compilationOptions
;
internal
readonly
int
index
;
internal
readonly
CodeActionPriority
?
priority
;
internal
readonly
bool
fixableDiagnosticsOnly
;
internal
TestParameters
(
ParseOptions
parseOptions
=
null
,
...
...
@@ -43,7 +44,8 @@ public struct TestParameters
IDictionary
<
OptionKey
,
object
>
options
=
null
,
object
fixProviderData
=
null
,
int
index
=
0
,
CodeActionPriority
?
priority
=
null
)
CodeActionPriority
?
priority
=
null
,
bool
fixableDiagnosticsOnly
=
true
)
{
this
.
parseOptions
=
parseOptions
;
this
.
compilationOptions
=
compilationOptions
;
...
...
@@ -51,6 +53,7 @@ public struct TestParameters
this
.
fixProviderData
=
fixProviderData
;
this
.
index
=
index
;
this
.
priority
=
priority
;
this
.
fixableDiagnosticsOnly
=
fixableDiagnosticsOnly
;
}
public
TestParameters
WithParseOptions
(
ParseOptions
parseOptions
)
...
...
@@ -106,11 +109,11 @@ private TestParameters WithScriptOptions(TestParameters parameters)
}
protected
async
Task
TestDiagnosticMissingAsync
(
string
initialMarkup
,
TestParameters
parameters
=
default
,
bool
fixableDiagnosticsOnly
=
true
)
string
initialMarkup
,
TestParameters
parameters
=
default
)
{
using
(
var
workspace
=
CreateWorkspaceFromOptions
(
initialMarkup
,
parameters
))
{
var
diagnostics
=
await
GetDiagnosticsWorkerAsync
(
workspace
,
parameters
,
fixableDiagnosticsOnly
);
var
diagnostics
=
await
GetDiagnosticsWorkerAsync
(
workspace
,
parameters
);
Assert
.
Equal
(
0
,
diagnostics
.
Length
);
}
}
...
...
@@ -126,7 +129,7 @@ private TestParameters WithScriptOptions(TestParameters parameters)
TestWorkspace
workspace
,
TestParameters
parameters
);
protected
abstract
Task
<
ImmutableArray
<
Diagnostic
>>
GetDiagnosticsWorkerAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
,
bool
fixableDiagnosticsOnly
);
TestWorkspace
workspace
,
TestParameters
parameters
);
protected
Task
TestSmartTagTextAsync
(
string
initialMarkup
,
string
displayText
,
int
index
)
=>
TestSmartTagTextAsync
(
initialMarkup
,
displayText
,
new
TestParameters
(
index
:
index
));
...
...
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionTest.cs
浏览文件 @
ee1b289d
...
...
@@ -39,7 +39,7 @@ public abstract class AbstractCodeActionTest : AbstractCodeActionOrUserDiagnosti
return
(
actions
,
actions
.
IsDefaultOrEmpty
?
null
:
actions
[
parameters
.
index
]);
}
protected
override
Task
<
ImmutableArray
<
Diagnostic
>>
GetDiagnosticsWorkerAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
,
bool
fixableDiagnosticsOnly
)
protected
override
Task
<
ImmutableArray
<
Diagnostic
>>
GetDiagnosticsWorkerAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
)
{
return
SpecializedTasks
.
EmptyImmutableArray
<
Diagnostic
>();
}
...
...
src/EditorFeatures/TestUtilities/Diagnostics/AbstractDiagnosticProviderBasedUserDiagnosticTest.cs
浏览文件 @
ee1b289d
...
...
@@ -120,7 +120,7 @@ public void TestSupportedDiagnosticsMessageHelpLinkUri()
}
internal
override
async
Task
<(
ImmutableArray
<
Diagnostic
>,
ImmutableArray
<
CodeAction
>,
CodeAction
actionToInvoke
)>
GetDiagnosticAndFixesAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
,
bool
fixableDiagnosticsOnly
)
TestWorkspace
workspace
,
TestParameters
parameters
)
{
var
providerAndFixer
=
GetOrCreateDiagnosticProviderAndFixer
(
workspace
,
parameters
);
...
...
@@ -145,7 +145,7 @@ public void TestSupportedDiagnosticsMessageHelpLinkUri()
var
dxs
=
diagnostics
.
Where
(
d
=>
ids
.
Contains
(
d
.
Id
)).
ToList
();
var
(
resultDiagnostics
,
codeActions
,
actionToInvoke
)
=
await
GetDiagnosticAndFixesAsync
(
dxs
,
provider
,
fixer
,
testDriver
,
document
,
span
,
annotation
,
parameters
.
index
);
if
(!
fixableDiagnosticsOnly
)
if
(!
parameters
.
fixableDiagnosticsOnly
)
{
resultDiagnostics
=
diagnostics
;
}
...
...
src/EditorFeatures/TestUtilities/Diagnostics/AbstractSuppressionDiagnosticTest.cs
浏览文件 @
ee1b289d
...
...
@@ -61,7 +61,7 @@ private ImmutableArray<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> dia
}
internal
override
async
Task
<(
ImmutableArray
<
Diagnostic
>,
ImmutableArray
<
CodeAction
>,
CodeAction
actionToInvoke
)>
GetDiagnosticAndFixesAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
,
bool
fixableDiagnosticsOnly
)
TestWorkspace
workspace
,
TestParameters
parameters
)
{
var
providerAndFixer
=
CreateDiagnosticProviderAndFixer
(
workspace
);
...
...
src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs
浏览文件 @
ee1b289d
...
...
@@ -31,7 +31,7 @@ namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
public
abstract
partial
class
AbstractUserDiagnosticTest
:
AbstractCodeActionOrUserDiagnosticTest
{
internal
abstract
Task
<(
ImmutableArray
<
Diagnostic
>,
ImmutableArray
<
CodeAction
>,
CodeAction
actionToInvoke
)>
GetDiagnosticAndFixesAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
,
bool
fixableDiagnosticsOnly
);
TestWorkspace
workspace
,
TestParameters
parameters
);
internal
abstract
Task
<
IEnumerable
<
Diagnostic
>>
GetDiagnosticsAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
);
...
...
@@ -69,14 +69,14 @@ public abstract partial class AbstractUserDiagnosticTest : AbstractCodeActionOrU
protected
override
async
Task
<(
ImmutableArray
<
CodeAction
>,
CodeAction
actionToInvoke
)>
GetCodeActionsWorkerAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
)
{
var
(
_
,
actions
,
actionToInvoke
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
,
fixableDiagnosticsOnly
:
true
);
var
(
_
,
actions
,
actionToInvoke
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
);
return
(
actions
,
actionToInvoke
);
}
protected
override
async
Task
<
ImmutableArray
<
Diagnostic
>>
GetDiagnosticsWorkerAsync
(
TestWorkspace
workspace
,
TestParameters
parameters
,
bool
fixableDiagnosticsOnly
)
TestWorkspace
workspace
,
TestParameters
parameters
)
{
var
(
dxs
,
_
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
,
fixableDiagnosticsOnly
);
var
(
dxs
,
_
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
);
return
dxs
;
}
...
...
@@ -308,7 +308,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
{
using
(
var
workspace
=
CreateWorkspaceFromOptions
(
initialMarkup
,
parameters
))
{
var
(
_
,
actions
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
,
fixableDiagnosticsOnly
:
true
);
var
(
_
,
actions
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
);
Assert
.
Equal
(
count
,
actions
.
Length
);
}
}
...
...
@@ -317,8 +317,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
string
initialMarkup
,
int
index
=
0
,
string
diagnosticId
=
null
,
TestParameters
parameters
=
default
,
bool
fixableDiagnosticsOnly
=
true
)
TestParameters
parameters
=
default
)
{
MarkupTestFile
.
GetSpans
(
initialMarkup
,
out
var
unused
,
out
ImmutableArray
<
TextSpan
>
spansList
);
...
...
@@ -328,7 +327,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
ISet
<
TextSpan
>
actualTextSpans
;
if
(
diagnosticId
==
null
)
{
var
(
diagnostics
,
_
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
,
fixableDiagnosticsOnly
);
var
(
diagnostics
,
_
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
workspace
,
parameters
);
actualTextSpans
=
diagnostics
.
Select
(
d
=>
d
.
Location
.
SourceSpan
).
ToSet
();
}
else
...
...
@@ -386,7 +385,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
defaultNamespace
:
defaultNamespace
);
var
testOptions
=
new
TestParameters
();
var
(
diagnostics
,
actions
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
testState
.
Workspace
,
testOptions
,
fixableDiagnosticsOnly
:
true
);
var
(
diagnostics
,
actions
,
_
)
=
await
GetDiagnosticAndFixesAsync
(
testState
.
Workspace
,
testOptions
);
var
generateTypeDiagFixes
=
diagnostics
.
SingleOrDefault
(
df
=>
GenerateTypeTestState
.
FixIds
.
Contains
(
df
.
Id
));
if
(
isMissing
)
...
...
src/EditorFeatures/VisualBasicTest/RemoveUnusedMembers/RemoveUnusedMembersTests.vb
浏览文件 @
ee1b289d
...
...
@@ -12,6 +12,10 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.RemoveUnusedMember
Return
(
New
VisualBasicRemoveUnusedMembersDiagnosticAnalyzer
(),
New
VisualBasicRemoveUnusedMembersCodeFixProvider
())
End
Function
Private
Overloads
Function
TestDiagnosticMissingAsync
(
initialMarkup
As
String
)
As
Task
Return
TestDiagnosticMissingAsync
(
initialMarkup
,
New
TestParameters
(
fixableDiagnosticsOnly
:
=
False
))
End
Function
Private
Shared
Function
Diagnostic
(
id
As
String
)
As
DiagnosticDescription
Return
TestHelpers
.
Diagnostic
(
id
)
End
Function
...
...
@@ -22,7 +26,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.RemoveUnusedMember
<
InlineData
(
"Protected"
)
>
<
InlineData
(
"Protected Friend"
)
>
Public
Async
Function
NonPrivateField
(
accessibility
As
String
)
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
$
"Class C
{accessibility} [|_goo|] As Integer
End Class"
)
...
...
@@ -34,7 +38,7 @@ End Class")
<
InlineData
(
"Protected"
)
>
<
InlineData
(
"Protected Friend"
)
>
Public
Async
Function
NonPrivateFieldWithConstantInitializer
(
accessibility
As
String
)
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
$
"Class C
{accessibility} [|_goo|] As Integer = 0
End Class"
)
...
...
@@ -46,7 +50,7 @@ End Class")
<
InlineData
(
"Protected"
)
>
<
InlineData
(
"Protected Friend"
)
>
Public
Async
Function
NonPrivateFieldWithNonConstantInitializer
(
accessibility
As
String
)
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
$
"Class C
{accessibility} [|_goo|] As Integer = _goo2
Private Shared ReadOnly _goo2 As Integer = 0
...
...
@@ -59,7 +63,7 @@ End Class")
<
InlineData
(
"Protected"
)
>
<
InlineData
(
"Protected Friend"
)
>
Public
Async
Function
NonPrivateMethod
(
accessibility
As
String
)
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
$
"Class C
{accessibility} Sub [|M|]
End Sub
...
...
@@ -72,7 +76,7 @@ End Class")
<
InlineData
(
"Protected"
)
>
<
InlineData
(
"Protected Friend"
)
>
Public
Async
Function
NonPrivateProperty
(
accessibility
As
String
)
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
$
"Class C
{accessibility} Property [|P|] As Integer
End Class"
)
...
...
@@ -84,7 +88,7 @@ End Class")
<
InlineData
(
"Protected"
)
>
<
InlineData
(
"Protected Friend"
)
>
Public
Async
Function
NonPrivateIndexer
(
accessibility
As
String
)
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
$
"Class C
{accessibility} Property [|P|](i As Integer) As Integer
Get
...
...
@@ -102,7 +106,7 @@ End Class")
<
InlineData
(
"Protected"
)
>
<
InlineData
(
"Protected Friend"
)
>
Public
Async
Function
NonPrivateEvent
(
accessibility
As
String
)
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
$
"Class C
{accessibility} Event [|E|] As EventHandler
End Class"
)
...
...
@@ -154,7 +158,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
InstanceConstructorIsUnused_NoArguments
()
As
Task
' We only flag constructors with arguments.
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|New()|]
End Sub
...
...
@@ -174,7 +178,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
StaticConstructorIsNotFlagged
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Shared Sub [|New()|]
End Sub
...
...
@@ -337,7 +341,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Function M() As Integer
...
...
@@ -348,7 +352,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_Lambda
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Function M() As Integer
...
...
@@ -359,7 +363,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_Accessor
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Property P As Integer
...
...
@@ -372,7 +376,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_DifferentInstance
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Function M() As Integer
...
...
@@ -383,7 +387,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_ObjectInitializer
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Function M() As C2
...
...
@@ -398,7 +402,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_ObjectInitializer_02
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Dim _goo2 As Integer
...
...
@@ -410,7 +414,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_MeInstance
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Function M() As Integer
...
...
@@ -421,7 +425,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_Attribute
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Const [|_goo|] As String =
""""
...
...
@@ -433,7 +437,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MethodIsInvoked
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|M|]()
End Sub
...
...
@@ -446,7 +450,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MethodIsAddressTaken
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|M|]()
End Sub
...
...
@@ -459,7 +463,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
GenericMethodIsInvoked_ExplicitTypeArguments
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|M1|](Of T)()
End Sub
...
...
@@ -472,7 +476,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
GenericMethodIsInvoked_ImplicitTypeArguments
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|M1|](Of T)(t1 As T)
End Sub
...
...
@@ -485,7 +489,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MethodInGenericTypeIsInvoked_NoTypeArguments
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C(Of T)
Private Sub [|M1|]()
End Sub
...
...
@@ -498,7 +502,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MethodInGenericTypeIsInvoked_NonConstructedType
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C(Of T)
Private Sub [|M1|]()
End Sub
...
...
@@ -511,7 +515,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MethodInGenericTypeIsInvoked_ConstructedType
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C(Of T)
Private Sub [|M1|]()
End Sub
...
...
@@ -524,7 +528,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
InstanceConstructorIsUsed_NoArguments
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|New|]()
End Sub
...
...
@@ -535,7 +539,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
InstanceConstructorIsUsed_NoArguments_AsNew
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|New|]()
End Sub
...
...
@@ -546,7 +550,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
InstanceConstructorIsUsed_WithArguments
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|New|](i As Integer)
End Sub
...
...
@@ -557,7 +561,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
InstanceConstructorIsUsed_WithArguments_AsNew
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|New|](i As Integer)
End Sub
...
...
@@ -568,7 +572,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
PropertyIsRead
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private ReadOnly Property [|P|] As Integer
Public Function M() As Integer
...
...
@@ -579,7 +583,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
IndexerIsRead
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Shared Property [|P|](i As Integer) As Integer
Get
...
...
@@ -597,7 +601,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
EventIsRead
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Event [|E|] As System.EventHandler
...
...
@@ -609,7 +613,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
EventIsSubscribed
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Event [|E|] As System.EventHandler
...
...
@@ -621,7 +625,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
EventIsRaised
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Imports System
Class C
...
...
@@ -801,7 +805,7 @@ End Class", parameters:=Nothing,
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsReadAndWritten
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Sub M()
...
...
@@ -813,7 +817,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
PropertyIsReadAndWritten
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private ReadOnly Property [|P|] As Integer
Public Sub M()
...
...
@@ -825,7 +829,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
IndexerIsReadAndWritten
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Property [|P|](i As Integer) As Integer
Get
...
...
@@ -887,7 +891,7 @@ End Class", parameters:=Nothing,
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsArg
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Sub M1()
...
...
@@ -900,7 +904,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsByRefArg
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Dim [|_goo|] As Integer
Public Sub M1()
...
...
@@ -913,7 +917,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MethodIsArg
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|M()|]
End Sub
...
...
@@ -928,7 +932,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
PropertyIsArg
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private ReadOnly Property [|P|] As Integer
Public Sub M1()
...
...
@@ -941,7 +945,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
IndexerIsArg
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Property [|P|](i As Integer) As Integer
Get
...
...
@@ -961,7 +965,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
EventIsArg
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Event [|_goo|] As System.EventHandler
Public Sub M1()
...
...
@@ -1013,7 +1017,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MultipleFields_SomeUnused_02
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private [|_goo|] = 0, _goo2 = 0
Public Function M() As Integer
...
...
@@ -1024,7 +1028,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_InNestedType
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private [|_goo|] As Integer
Private Class Nested
...
...
@@ -1037,7 +1041,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
MethodIsInvoked_InNestedType
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Sub [|M1|]()
End Sub
...
...
@@ -1066,7 +1070,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldOfNestedTypeIsRead
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private Class Nested
Private [|_goo|] As Integer
...
...
@@ -1089,7 +1093,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_PartialClass
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Partial Class C
Private [|_goo|] As Integer
End Class
...
...
@@ -1103,7 +1107,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_PartialClass_DifferentFile
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"<Workspace>
<Project Language=
""
Visual Basic
""
AssemblyName=
""
Assembly1
""
CommonReferences=
""
true
""
>
<Document>
...
...
@@ -1146,7 +1150,7 @@ End Class
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsRead_InParens
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private [|_goo|] As Integer
Public Function M() As Integer
...
...
@@ -1157,7 +1161,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsWritten_InParens
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private [|_goo|] As Integer
Public Sub M()
...
...
@@ -1169,7 +1173,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsUnusedInType_SyntaxError
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private [|_goo|] As Integer
Public Sub M()
...
...
@@ -1180,7 +1184,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsUnusedInType_SemanticError
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private [|_goo|] As Integer
Public Sub M()
...
...
@@ -1237,7 +1241,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldIsGeneratedCode
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
<System.CodeDom.Compiler.GeneratedCodeAttribute(
""""
,
""""
)>
Private [|i|] As Integer
...
...
@@ -1249,7 +1253,7 @@ End Class")
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsRemoveUnusedMembers
)
>
Public
Async
Function
FieldUsedInGeneratedCode
()
As
Task
Await
Test
MissingInRegularAndScript
Async
(
Await
Test
DiagnosticMissing
Async
(
"Class C
Private [|i|] As Integer
...
...
src/EditorFeatures/VisualBasicTest/SimplifyTypeNames/SimplifyTypeNamesTests.vb
浏览文件 @
ee1b289d
...
...
@@ -1861,7 +1861,7 @@ End Module
Await
TestInRegularAndScriptAsync
(
source
.
Value
,
expected
.
Value
)
Using
workspace
=
TestWorkspace
.
CreateVisualBasic
(
source
.
Value
)
Dim
diagnosticAndFixes
=
Await
GetDiagnosticAndFixesAsync
(
workspace
,
New
TestParameters
()
,
fixableDiagnosticsOnly
:
=
True
)
Dim
diagnosticAndFixes
=
Await
GetDiagnosticAndFixesAsync
(
workspace
,
New
TestParameters
())
Dim
span
=
diagnosticAndFixes
.
Item1
.
First
().
Location
.
SourceSpan
Assert
.
NotEqual
(
span
.
Start
,
0
)
Assert
.
NotEqual
(
span
.
End
,
0
)
...
...
@@ -1910,7 +1910,7 @@ End Namespace
Await
TestInRegularAndScriptAsync
(
source
.
Value
,
expected
.
Value
)
Using
workspace
=
TestWorkspace
.
CreateVisualBasic
(
source
.
Value
)
Dim
diagnosticAndFixes
=
Await
GetDiagnosticAndFixesAsync
(
workspace
,
New
TestParameters
()
,
fixableDiagnosticsOnly
:
=
True
)
Dim
diagnosticAndFixes
=
Await
GetDiagnosticAndFixesAsync
(
workspace
,
New
TestParameters
())
Dim
span
=
diagnosticAndFixes
.
Item1
.
First
().
Location
.
SourceSpan
Assert
.
Equal
(
span
.
Start
,
expected
.
Value
.
ToString
.
Replace
(
vbLf
,
vbCrLf
).
IndexOf
(
"new C"
,
StringComparison
.
Ordinal
)
+
4
)
Assert
.
Equal
(
span
.
Length
,
"A.B"
.
Length
)
...
...
@@ -1945,7 +1945,7 @@ End Module
Await
TestInRegularAndScriptAsync
(
source
.
Value
,
expected
.
Value
)
Using
workspace
=
TestWorkspace
.
CreateVisualBasic
(
source
.
Value
)
Dim
diagnosticAndFixes
=
Await
GetDiagnosticAndFixesAsync
(
workspace
,
New
TestParameters
()
,
fixableDiagnosticsOnly
:
=
True
)
Dim
diagnosticAndFixes
=
Await
GetDiagnosticAndFixesAsync
(
workspace
,
New
TestParameters
())
Dim
span
=
diagnosticAndFixes
.
Item1
.
First
().
Location
.
SourceSpan
Assert
.
Equal
(
span
.
Start
,
expected
.
Value
.
ToString
.
Replace
(
vbLf
,
vbCrLf
).
IndexOf
(
"Console.WriteLine(
""
goo
""
)"
,
StringComparison
.
Ordinal
))
Assert
.
Equal
(
span
.
Length
,
"System"
.
Length
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录