Skip to content

Commit 551d825

Browse files
Improve coverage for SA1010 by adding test for creation of implicitly typed arrays
1 parent 92d66c6 commit 551d825

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/SA1010UnitTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,23 @@ public void TestMethod(IDictionary<ulong, string> items)
216216
var expected = Diagnostic(DescriptorNotPreceded).WithLocation(8, 62);
217217
await VerifyCSharpFixAsync(testCode, expected, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
218218
}
219+
220+
// NOTE: This case is handled by SA1026, so it's intentionally allowed here
221+
[Fact]
222+
public async Task TestImplicitlyTypedArrayCreationAsync()
223+
{
224+
var testCode = @"
225+
namespace TestNamespace
226+
{
227+
public class TestClass
228+
{
229+
public void TestMethod()
230+
{
231+
var x = new [] { 0, 1 };
232+
}
233+
}
234+
}";
235+
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
236+
}
219237
}
220238
}

0 commit comments

Comments
 (0)