File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
tests/FSharpLint.Core.Tests/Rules/Conventions/Naming Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -209,3 +209,49 @@ type Foo() =
209209"""
210210
211211 Assert.IsTrue this.NoErrorsExist
212+
213+ [<Test>]
214+ member this. ``Non - asynchronous function without explicit type named Async * should give violations offering removing Async prefix`` () =
215+ this.Parse """
216+ module Foo =
217+ let AsyncBar() =
218+ 1
219+ """
220+
221+ Assert.IsTrue this.ErrorsExist
222+ StringAssert.Contains( " Bar" , this.ErrorMsg)
223+
224+ [<Test>]
225+ member this. ``Non - asynchronous function without explicit type named * Async should give violations offering removing Async suffix`` () =
226+ this.Parse """
227+ module Foo =
228+ let BarAsync() =
229+ 1
230+ """
231+
232+ Assert.IsTrue this.ErrorsExist
233+ StringAssert.Contains( " Bar" , this.ErrorMsg)
234+
235+ [<Test>]
236+ member this. ``Async functions without explicit type with Async prefix should give no violations`` () =
237+ this.Parse """
238+ let AsyncFoo() =
239+ async { return 1 }
240+ let AsyncBar() =
241+ async { return () }
242+ let AsyncBaz() =
243+ async { do! Async.Sleep(1000) }
244+ """
245+
246+ Assert.IsTrue this.NoErrorsExist
247+
248+ [<Test>]
249+ member this. ``Functions without explicit type that return Task with Async suffix should give no violations`` () =
250+ this.Parse """
251+ let FooAsync() =
252+ task {}
253+ let BarAsync() =
254+ task { return 1 }
255+ """
256+
257+ Assert.IsTrue this.NoErrorsExist
You can’t perform that action at this time.
0 commit comments