Skip to content

Commit 4484b60

Browse files
committed
Merge pull request #2538 from roadz99/SA1008
Add test case for issue #2532
2 parents baeb126 + af66708 commit 4484b60

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/SpacingRules/SA1008CSharp7UnitTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public class TestClass
200200

201201
[Fact]
202202
[WorkItem(2472, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2472")]
203+
[WorkItem(2532, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2532")]
203204
public async Task TestTupleOutParametersAsync()
204205
{
205206
var testCode = @"namespace TestNamespace
@@ -209,6 +210,13 @@ public class TestClass
209210
public int TestMethod1(out( int, int)[] arg) => throw null;
210211
public int TestMethod2(out(int, int)[] arg) => throw null;
211212
public int TestMethod3(out ( int, int)[] arg) => throw null;
213+
public void TestMethod4()
214+
{
215+
var x = new System.Collections.Generic.Dictionary<int, (int, bool)>();
216+
x.TryGetValue(1, out( int, bool) value1);
217+
x.TryGetValue(2, out(int, bool) value2);
218+
x.TryGetValue(3, out ( int, bool) value3);
219+
}
212220
}
213221
}
214222
";
@@ -220,6 +228,13 @@ public class TestClass
220228
public int TestMethod1(out (int, int)[] arg) => throw null;
221229
public int TestMethod2(out (int, int)[] arg) => throw null;
222230
public int TestMethod3(out (int, int)[] arg) => throw null;
231+
public void TestMethod4()
232+
{
233+
var x = new System.Collections.Generic.Dictionary<int, (int, bool)>();
234+
x.TryGetValue(1, out (int, bool) value1);
235+
x.TryGetValue(2, out (int, bool) value2);
236+
x.TryGetValue(3, out (int, bool) value3);
237+
}
223238
}
224239
}
225240
";
@@ -235,6 +250,12 @@ public class TestClass
235250

236251
// TestMethod3
237252
this.CSharpDiagnostic(DescriptorNotFollowed).WithLocation(7, 36),
253+
254+
// TestMethod4
255+
this.CSharpDiagnostic(DescriptorPreceded).WithLocation(11, 33),
256+
this.CSharpDiagnostic(DescriptorNotFollowed).WithLocation(11, 33),
257+
this.CSharpDiagnostic(DescriptorPreceded).WithLocation(12, 33),
258+
this.CSharpDiagnostic(DescriptorNotFollowed).WithLocation(13, 34),
238259
};
239260

240261
await this.VerifyCSharpDiagnosticAsync(testCode, expectedDiagnostic, CancellationToken.None).ConfigureAwait(false);

0 commit comments

Comments
 (0)