Skip to content

Commit

Permalink
S112: Add FN repro for #7910
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-mikula-sonarsource committed Aug 29, 2023
1 parent 334bb3a commit 915049f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ namespace SonarAnalyzer.UnitTest.Rules
[TestClass]
public class ThrowReservedExceptionsTest
{
private readonly VerifierBuilder builderCS = new VerifierBuilder<CS.ThrowReservedExceptions>();

[TestMethod]
public void ThrowReservedExceptions_CS() =>
builderCS.AddPaths("ThrowReservedExceptions.cs").Verify();

[TestMethod]
public void ThrowReservedExceptions_CSharp() =>
new VerifierBuilder<CS.ThrowReservedExceptions>().AddPaths("ThrowReservedExceptions.cs").Verify();
public void ThrowReservedExceptions_CSharp8() =>
builderCS.AddPaths("ThrowReservedExceptions.CSharp8.cs").WithOptions(ParseOptionsHelper.FromCSharp8).Verify();

[TestMethod]
public void ThrowReservedExceptions_VisualBasic() =>
public void ThrowReservedExceptions_VB() =>
new VerifierBuilder<VB.ThrowReservedExceptions>().AddPaths("ThrowReservedExceptions.vb").Verify();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

public class Sample
{
public void NullCoalesce(object arg)
{
_ = arg ?? throw new Exception(); // FN
}
}

0 comments on commit 915049f

Please sign in to comment.