Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8637fb62
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,发现更多精彩内容 >>
提交
8637fb62
编写于
4月 03, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert combinatorics tests to theories
上级
0064c7de
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
34 deletion
+63
-34
src/EditorFeatures/CSharpTest/ChangeSignature/ChangeSignature_CheckAllSignatureChanges.cs
...angeSignature/ChangeSignature_CheckAllSignatureChanges.cs
+23
-8
src/EditorFeatures/DiagnosticsTestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs
...Utilities/ChangeSignature/AbstractChangeSignatureTests.cs
+7
-14
src/EditorFeatures/VisualBasicTest/ChangeSignature/ChangeSignature_CheckAllSignatureChanges.vb
...angeSignature/ChangeSignature_CheckAllSignatureChanges.vb
+33
-12
未找到文件。
src/EditorFeatures/CSharpTest/ChangeSignature/ChangeSignature_CheckAllSignatureChanges.cs
浏览文件 @
8637fb62
...
...
@@ -13,8 +13,9 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ChangeSignature
{
public
partial
class
ChangeSignatureTests
:
AbstractChangeSignatureTests
{
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
public
async
Task
TestAllSignatureChanges_1This_3Regular_2Default_1Params
()
[
WpfTheory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
[
MemberData
(
nameof
(
AbstractChangeSignatureTests
.
GetAllSignatureSpecificationsForTheory
),
new
[]
{
1
,
3
,
2
,
1
},
MemberType
=
typeof
(
AbstractChangeSignatureTests
))]
public
async
Task
TestAllSignatureChanges_1This_3Regular_2Default_1Params
(
int
totalParameters
,
int
[]
signature
)
{
var
markup
=
@"
static class Ext
...
...
@@ -57,12 +58,19 @@ static class Ext
M(p: new[] { 5 }, y: ""four"", x: 3, c: true, b: ""two"", a: 1, o: t);
}
}"
;
var
signaturePartCounts
=
new
[]
{
1
,
3
,
2
,
1
};
await
TestAllSignatureChangesAsync
(
LanguageNames
.
CSharp
,
markup
,
signaturePartCounts
);
await
TestChangeSignatureViaCommandAsync
(
LanguageNames
.
CSharp
,
markup
,
expectedSuccess
:
true
,
updatedSignature
:
signature
,
totalParameters
:
totalParameters
,
verifyNoDiagnostics
:
true
);
}
[
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
public
async
Task
TestAllSignatureChanges_OnDelegate_3Regular
()
[
WpfTheory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)]
[
MemberData
(
nameof
(
AbstractChangeSignatureTests
.
GetAllSignatureSpecificationsForTheory
),
new
[]
{
0
,
3
,
0
,
0
},
MemberType
=
typeof
(
AbstractChangeSignatureTests
))]
public
async
Task
TestAllSignatureChanges_OnDelegate_3Regular
(
int
totalParameters
,
int
[]
signature
)
{
var
markup
=
@"
using System;
...
...
@@ -151,8 +159,15 @@ void M()
/// <param name=""c""></param>
void Goo5(int a, string b, bool c) { }
}"
;
var
signaturePartCounts
=
new
[]
{
0
,
3
,
0
,
0
};
await
TestAllSignatureChangesAsync
(
LanguageNames
.
CSharp
,
markup
,
signaturePartCounts
,
new
CSharpParseOptions
(
LanguageVersion
.
CSharp7
));
await
TestChangeSignatureViaCommandAsync
(
LanguageNames
.
CSharp
,
markup
,
expectedSuccess
:
true
,
updatedSignature
:
signature
,
totalParameters
:
totalParameters
,
verifyNoDiagnostics
:
true
,
parseOptions
:
new
CSharpParseOptions
(
LanguageVersion
.
CSharp7
));
}
}
}
src/EditorFeatures/DiagnosticsTestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs
浏览文件 @
8637fb62
...
...
@@ -157,7 +157,7 @@ private string GetSignatureDescriptionString(int[] signature, int? totalParamete
/// </summary>
/// <param name="signaturePartCounts">A four element array containing [s, m, n, p] as
/// described above.</param>
public
async
Task
TestAllSignatureChangesAsync
(
string
languageName
,
string
markup
,
int
[]
signaturePartCounts
,
ParseOptions
parseOptions
=
null
)
public
static
IEnumerable
<
object
>
GetAllSignatureSpecificationsForTheory
(
int
[]
signaturePartCounts
)
{
Assert
.
Equal
(
4
,
signaturePartCounts
.
Length
);
Assert
.
True
(
signaturePartCounts
[
0
]
==
0
||
signaturePartCounts
[
0
]
==
1
);
...
...
@@ -167,18 +167,11 @@ public async Task TestAllSignatureChangesAsync(string languageName, string marku
foreach
(
var
signature
in
GetAllSignatureSpecifications
(
signaturePartCounts
))
{
await
TestChangeSignatureViaCommandAsync
(
languageName
,
markup
,
expectedSuccess
:
true
,
updatedSignature
:
signature
,
totalParameters
:
totalParameters
,
verifyNoDiagnostics
:
true
,
parseOptions
:
parseOptions
);
yield
return
new
object
[]
{
totalParameters
,
signature
};
}
}
private
IEnumerable
<
int
[
]>
GetAllSignatureSpecifications
(
int
[]
signaturePartCounts
)
private
static
IEnumerable
<
int
[
]>
GetAllSignatureSpecifications
(
int
[]
signaturePartCounts
)
{
var
regularParameterStartIndex
=
signaturePartCounts
[
0
];
var
defaultValueParameterStartIndex
=
signaturePartCounts
[
0
]
+
signaturePartCounts
[
1
];
...
...
@@ -204,7 +197,7 @@ private IEnumerable<int[]> GetAllSignatureSpecifications(int[] signaturePartCoun
}
}
private
IEnumerable
<
IEnumerable
<
int
>>
GetPermutedSubsets
(
int
startIndex
,
int
count
)
private
static
IEnumerable
<
IEnumerable
<
int
>>
GetPermutedSubsets
(
int
startIndex
,
int
count
)
{
foreach
(
var
subset
in
GetSubsets
(
Enumerable
.
Range
(
startIndex
,
count
)))
{
...
...
@@ -215,7 +208,7 @@ private IEnumerable<IEnumerable<int>> GetPermutedSubsets(int startIndex, int cou
}
}
private
IEnumerable
<
IEnumerable
<
int
>>
GetPermutations
(
IEnumerable
<
int
>
list
)
private
static
IEnumerable
<
IEnumerable
<
int
>>
GetPermutations
(
IEnumerable
<
int
>
list
)
{
if
(!
list
.
Any
())
{
...
...
@@ -236,7 +229,7 @@ private IEnumerable<IEnumerable<int>> GetPermutations(IEnumerable<int> list)
}
}
private
IEnumerable
<
int
>
GetListWithoutElementAtIndex
(
IEnumerable
<
int
>
list
,
int
skippedIndex
)
private
static
IEnumerable
<
int
>
GetListWithoutElementAtIndex
(
IEnumerable
<
int
>
list
,
int
skippedIndex
)
{
var
index
=
0
;
foreach
(
var
x
in
list
)
...
...
@@ -250,7 +243,7 @@ private IEnumerable<int> GetListWithoutElementAtIndex(IEnumerable<int> list, int
}
}
private
IEnumerable
<
IEnumerable
<
int
>>
GetSubsets
(
IEnumerable
<
int
>
list
)
private
static
IEnumerable
<
IEnumerable
<
int
>>
GetSubsets
(
IEnumerable
<
int
>
list
)
{
if
(!
list
.
Any
())
{
...
...
src/EditorFeatures/VisualBasicTest/ChangeSignature/ChangeSignature_CheckAllSignatureChanges.vb
浏览文件 @
8637fb62
...
...
@@ -9,8 +9,9 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ChangeSignature
Partial
Public
Class
ChangeSignatureTests
Inherits
AbstractChangeSignatureTests
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)
>
Public
Async
Function
TestAllSignatureChanges_1This_3Regular_2Default
()
As
Task
<
WpfTheory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)
>
<
MemberData
(
NameOf
(
AbstractChangeSignatureTests
.
GetAllSignatureSpecificationsForTheory
),
New
Integer
()
{
1
,
3
,
2
,
0
},
MemberType
:
=
GetType
(
AbstractChangeSignatureTests
))
>
Public
Async
Function
TestAllSignatureChanges_1This_3Regular_2Default
(
totalParameters
As
Integer
,
signature
As
Integer
())
As
Task
Dim
markup
=
<
Text
><
!
[
CDATA
[
Option Strict On
...
...
@@ -47,12 +48,19 @@ Module Program
End
Sub
End
Module
]]
></
Text
>
.
NormalizedValue
()
Dim
signaturePartCounts
=
{
1
,
3
,
2
,
0
}
Await
TestAllSignatureChangesAsync
(
LanguageNames
.
VisualBasic
,
markup
,
signaturePartCounts
)
Await
TestChangeSignatureViaCommandAsync
(
LanguageNames
.
VisualBasic
,
markup
,
expectedSuccess
:
=
True
,
updatedSignature
:
=
signature
,
totalParameters
:
=
totalParameters
,
verifyNoDiagnostics
:
=
True
)
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)
>
Public
Async
Function
TestAllSignatureChanges_1This_3Regular_1ParamArray
()
As
Task
<
WpfTheory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)
>
<
MemberData
(
NameOf
(
AbstractChangeSignatureTests
.
GetAllSignatureSpecificationsForTheory
),
New
Integer
()
{
1
,
3
,
0
,
1
},
MemberType
:
=
GetType
(
AbstractChangeSignatureTests
))
>
Public
Async
Function
TestAllSignatureChanges_1This_3Regular_1ParamArray
(
totalParameters
As
Integer
,
signature
As
Integer
())
As
Task
Dim
markup
=
<
Text
><
!
[
CDATA
[
Option Strict On
...
...
@@ -72,12 +80,19 @@ Module Program
End
Sub
End
Module
]]
></
Text
>
.
NormalizedValue
()
Dim
signaturePartCounts
=
{
1
,
3
,
0
,
1
}
Await
TestAllSignatureChangesAsync
(
LanguageNames
.
VisualBasic
,
markup
,
signaturePartCounts
)
Await
TestChangeSignatureViaCommandAsync
(
LanguageNames
.
VisualBasic
,
markup
,
expectedSuccess
:
=
True
,
updatedSignature
:
=
signature
,
totalParameters
:
=
totalParameters
,
verifyNoDiagnostics
:
=
True
)
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)
>
Public
Async
Function
TestAllSignatureChanges_Delegate_3
()
As
Task
<
WpfTheory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ChangeSignature
)
>
<
MemberData
(
NameOf
(
AbstractChangeSignatureTests
.
GetAllSignatureSpecificationsForTheory
),
New
Integer
()
{
0
,
3
,
0
,
0
},
MemberType
:
=
GetType
(
AbstractChangeSignatureTests
))
>
Public
Async
Function
TestAllSignatureChanges_Delegate_3
(
totalParameters
As
Integer
,
signature
As
Integer
())
As
Task
Dim
markup
=
<
Text
><
!
[
CDATA
[
Option Strict On
...
...
@@ -135,8 +150,14 @@ Class C
End
Sub
End
Class
]]
></
Text
>
.
NormalizedValue
()
Dim
signaturePartCounts
=
{
0
,
3
,
0
,
0
}
Await
TestAllSignatureChangesAsync
(
LanguageNames
.
VisualBasic
,
markup
,
signaturePartCounts
)
Await
TestChangeSignatureViaCommandAsync
(
LanguageNames
.
VisualBasic
,
markup
,
expectedSuccess
:
=
True
,
updatedSignature
:
=
signature
,
totalParameters
:
=
totalParameters
,
verifyNoDiagnostics
:
=
True
)
End
Function
End
Class
End
Namespace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录