Skip to content

Commit 3c3c99b

Browse files
committed
Add regression test for closing parenthesis followed by pointer dereference
1 parent f1bf53b commit 3c3c99b

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/SA1009UnitTests.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,17 @@ public async Task TestSpaceMethodCallFollowedByConditionalAccessPropertyGetAsync
324324
await this.TestWhitespaceInStatementOrDeclAsync(invalidStatement, validStatement, expected).ConfigureAwait(false);
325325
}
326326

327+
[Fact]
328+
public async Task TestSpaceMethodCallFollowedByPointerDereferenceAsync()
329+
{
330+
var invalidStatement = @"var o = GetPointer() ->ToString();";
331+
var validStatement = @"var o = GetPointer()->ToString();";
332+
333+
DiagnosticResult expected = this.CSharpDiagnostic().WithArguments(" not", "followed").WithLocation(7, 32);
334+
335+
await this.TestWhitespaceInStatementOrDeclAsync(invalidStatement, validStatement, expected).ConfigureAwait(false);
336+
}
337+
327338
[Fact]
328339
public async Task TestSpaceOperationInDoubleSetOfParenthesisAsync()
329340
{
@@ -820,7 +831,7 @@ private async Task TestWhitespaceInStatementOrDeclAsync(string originalStatement
820831
{{
821832
class Bar
822833
{{
823-
void DoIt()
834+
unsafe void DoIt()
824835
{{
825836
{0}
826837
}}
@@ -835,6 +846,11 @@ Baz GetB()
835846
return null;
836847
}}
837848
849+
unsafe int* GetPointer()
850+
{{
851+
return null;
852+
}}
853+
838854
class Baz
839855
{{
840856
public object this[int i]

0 commit comments

Comments
 (0)