File tree Expand file tree Collapse file tree 1 file changed +48
-2
lines changed
StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/SpacingRules Expand file tree Collapse file tree 1 file changed +48
-2
lines changed Original file line number Diff line number Diff line change 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 . CSharp8 . SpacingRules
75{
86 using System . Threading ;
@@ -237,5 +235,53 @@ await VerifyCSharpFixAsync(
237235 fixedCode ,
238236 CancellationToken . None ) . ConfigureAwait ( false ) ;
239237 }
238+
239+ [ Fact ]
240+ [ WorkItem ( 3007 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3007" ) ]
241+ public async Task TestAwaitForEachSpaceAfterParenAsync ( )
242+ {
243+ var testCode = @"
244+ namespace TestNamespace
245+ {
246+ using System.Collections.Generic;
247+ using System.Threading.Tasks;
248+
249+ public class TestClass
250+ {
251+ public async Task ConsumeAsync(IAsyncEnumerable<int> values)
252+ {
253+ await foreach {|#0:(|} var value in values)
254+ {
255+ _ = value;
256+ }
257+ }
258+ }
259+ }
260+ " ;
261+ var fixedCode = @"
262+ namespace TestNamespace
263+ {
264+ using System.Collections.Generic;
265+ using System.Threading.Tasks;
266+
267+ public class TestClass
268+ {
269+ public async Task ConsumeAsync(IAsyncEnumerable<int> values)
270+ {
271+ await foreach (var value in values)
272+ {
273+ _ = value;
274+ }
275+ }
276+ }
277+ }
278+ " ;
279+
280+ await VerifyCSharpFixAsync (
281+ testCode ,
282+ Diagnostic ( DescriptorNotFollowed ) . WithLocation ( 0 ) ,
283+ fixedCode ,
284+ CancellationToken . None ) . ConfigureAwait ( false ) ;
285+ }
240286 }
241287}
You can’t perform that action at this time.
0 commit comments