11// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
22// Licensed under the MIT License. See LICENSE in the project root for license information.
33
4- #nullable disable
5-
64namespace StyleCop . Analyzers . Test . SpacingRules
75{
86 using System . Threading ;
@@ -61,8 +59,8 @@ public void TestMethod()
6159 x = $""{test}"";
6260 x = $""({test})"";
6361 x = $""({test} )"";
64- x = $""{test }"";
65- x = $""{test } "";
62+ x = $""{test {|#0:}| }"";
63+ x = $""{test {|#1:}| } "";
6664 }
6765 }
6866}
@@ -88,8 +86,8 @@ public void TestMethod()
8886
8987 DiagnosticResult [ ] expected =
9088 {
91- Diagnostic ( ) . WithLocation ( 12 , 25 ) . WithArguments ( " not" , "preceded" ) ,
92- Diagnostic ( ) . WithLocation ( 13 , 25 ) . WithArguments ( " not" , "preceded" ) ,
89+ Diagnostic ( ) . WithLocation ( 0 ) . WithArguments ( " not" , "preceded" ) ,
90+ Diagnostic ( ) . WithLocation ( 1 ) . WithArguments ( " not" , "preceded" ) ,
9391 } ;
9492
9593 await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -107,7 +105,7 @@ public async Task TestPropertyDeclarationAsync()
107105 public class TestClass
108106 {
109107 public int TestProperty1 { get; set; }
110- public int TestProperty2 { get; set;}
108+ public int TestProperty2 { get; set;{|#0:}| }
111109 }
112110}
113111" ;
@@ -124,7 +122,7 @@ public class TestClass
124122
125123 DiagnosticResult [ ] expected =
126124 {
127- Diagnostic ( ) . WithLocation ( 6 , 45 ) . WithArguments ( string . Empty , "preceded" ) ,
125+ Diagnostic ( ) . WithLocation ( 0 ) . WithArguments ( string . Empty , "preceded" ) ,
128126 } ;
129127
130128 await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -146,9 +144,9 @@ public class TestClass
146144 public void TestMethod()
147145 {
148146 new Dictionary<int, int> { { 1, 1 } };
149- new Dictionary<int, int> { { 1, 1} };
150- new Dictionary<int, int> { { 1, 1 } };
151- new Dictionary<int, int> { { 1, 1} };
147+ new Dictionary<int, int> { { 1, 1{|#0:}| } };
148+ new Dictionary<int, int> { { 1, 1 {|#1:}|}{|#2:}| };
149+ new Dictionary<int, int> { { 1, 1{|#3:}|}{|#4:}| };
152150 }
153151 }
154152}
@@ -173,12 +171,12 @@ public void TestMethod()
173171
174172 DiagnosticResult [ ] expected =
175173 {
176- Diagnostic ( ) . WithLocation ( 10 , 46 ) . WithArguments ( string . Empty , "preceded" ) ,
177- Diagnostic ( ) . WithLocation ( 11 , 47 ) . WithArguments ( string . Empty , "followed" ) ,
178- Diagnostic ( ) . WithLocation ( 11 , 48 ) . WithArguments ( string . Empty , "preceded" ) ,
179- Diagnostic ( ) . WithLocation ( 12 , 46 ) . WithArguments ( string . Empty , "preceded" ) ,
180- Diagnostic ( ) . WithLocation ( 12 , 46 ) . WithArguments ( string . Empty , "followed" ) ,
181- Diagnostic ( ) . WithLocation ( 12 , 47 ) . WithArguments ( string . Empty , "preceded" ) ,
174+ Diagnostic ( ) . WithLocation ( 0 ) . WithArguments ( string . Empty , "preceded" ) ,
175+ Diagnostic ( ) . WithLocation ( 1 ) . WithArguments ( string . Empty , "followed" ) ,
176+ Diagnostic ( ) . WithLocation ( 2 ) . WithArguments ( string . Empty , "preceded" ) ,
177+ Diagnostic ( ) . WithLocation ( 3 ) . WithArguments ( string . Empty , "preceded" ) ,
178+ Diagnostic ( ) . WithLocation ( 3 ) . WithArguments ( string . Empty , "followed" ) ,
179+ Diagnostic ( ) . WithLocation ( 4 ) . WithArguments ( string . Empty , "preceded" ) ,
182180 } ;
183181
184182 await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -297,9 +295,9 @@ public void TestMethod1(object[] a)
297295 public void TestMethod2()
298296 {
299297 TestMethod1(new object[] { });
300- TestMethod1(new object[] {});
298+ TestMethod1(new object[] {{|#0:}| });
301299 TestMethod1(new object[] { } );
302- TestMethod1(new object[] {} );
300+ TestMethod1(new object[] {{|#1:}| } );
303301 }
304302 }
305303}
@@ -327,8 +325,8 @@ public void TestMethod2()
327325 // space between closing brace and closing parenthesis should be reported by SA1009
328326 DiagnosticResult [ ] expected =
329327 {
330- Diagnostic ( ) . WithLocation ( 12 , 39 ) . WithArguments ( string . Empty , "preceded" ) ,
331- Diagnostic ( ) . WithLocation ( 14 , 39 ) . WithArguments ( string . Empty , "preceded" ) ,
328+ Diagnostic ( ) . WithLocation ( 0 ) . WithArguments ( string . Empty , "preceded" ) ,
329+ Diagnostic ( ) . WithLocation ( 1 ) . WithArguments ( string . Empty , "preceded" ) ,
332330 } ;
333331
334332 await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -383,12 +381,12 @@ public async Task TestMissingTokenAsync()
383381 {
384382 string testCode = @"
385383class ClassName
386- {
384+ {{|#0:|}
387385" ;
388386
389387 DiagnosticResult [ ] expected =
390388 {
391- DiagnosticResult . CompilerError ( "CS1513" ) . WithMessage ( "} expected" ) . WithLocation ( 3 , 2 ) ,
389+ DiagnosticResult . CompilerError ( "CS1513" ) . WithMessage ( "} expected" ) . WithLocation ( 0 ) ,
392390 } ;
393391
394392 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
0 commit comments