Skip to content

Commit

Permalink
Improve coverage for SA1010 by adding test for creation of implicitly…
Browse files Browse the repository at this point in the history
… typed arrays
  • Loading branch information
bjornhellander committed Aug 13, 2023
1 parent 92d66c6 commit 551d825
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,23 @@ public void TestMethod(IDictionary<ulong, string> items)
var expected = Diagnostic(DescriptorNotPreceded).WithLocation(8, 62);
await VerifyCSharpFixAsync(testCode, expected, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
}

// NOTE: This case is handled by SA1026, so it's intentionally allowed here
[Fact]
public async Task TestImplicitlyTypedArrayCreationAsync()
{
var testCode = @"
namespace TestNamespace
{
public class TestClass
{
public void TestMethod()
{
var x = new [] { 0, 1 };
}
}
}";
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
}
}

0 comments on commit 551d825

Please sign in to comment.