diff --git a/csharp/extractor/Semmle.Extraction.Tests/StubGenerator.cs b/csharp/extractor/Semmle.Extraction.Tests/StubGenerator.cs index 598ff77ca25b..ea60c60bad61 100644 --- a/csharp/extractor/Semmle.Extraction.Tests/StubGenerator.cs +++ b/csharp/extractor/Semmle.Extraction.Tests/StubGenerator.cs @@ -42,7 +42,7 @@ public void StubGeneratorMethodTest() // Setup const string source = @" public class MyTest { - public int M1(string arg1) { return 0;} + public int M1(string arg1) { return 0; } }"; // Execute @@ -56,6 +56,26 @@ public class MyTest { Assert.Equal(expected, stub); } + [Fact] + public void StubGeneratorRefReadonlyParameterTest() + { + // Setup + const string source = @" +public class MyTest { + public int M1(ref readonly Guid guid) { return 0; } +}"; + + // Execute + var stub = GenerateStub(source); + + // Verify + const string expected = @"public class MyTest { +public int M1(ref readonly Guid guid) => throw null; +} +"; + Assert.Equal(expected, stub); + } + private static string GenerateStub(string source) { var st = CSharpSyntaxTree.ParseText(source);