File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
tests/FSharpLint.Core.Tests/Rules/Conventions/Naming Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -209,3 +209,60 @@ 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. ``Non - asynchronous method without explicit type named Async * should give violations offering removing Async prefix`` () =
237+ this.Parse """
238+ type Foo() =
239+ member this.AsyncBar() =
240+ 1
241+ """
242+
243+ Assert.IsTrue this.ErrorsExist
244+ StringAssert.Contains( " Bar" , this.ErrorMsg)
245+
246+ [<Test>]
247+ member this. ``Async functions without explicit type with Async prefix should give no violations`` () =
248+ this.Parse """
249+ let AsyncFoo() =
250+ async { return 1 }
251+ let AsyncBar() =
252+ async { return () }
253+ let AsyncBaz() =
254+ async { do! Async.Sleep(1000) }
255+ """
256+
257+ Assert.IsTrue this.NoErrorsExist
258+
259+ [<Test>]
260+ member this. ``Functions without explicit type that return Task with Async suffix should give no violations`` () =
261+ this.Parse """
262+ let FooAsync() =
263+ task {}
264+ let BarAsync() =
265+ task { return 1 }
266+ """
267+
268+ Assert.IsTrue this.NoErrorsExist
You can’t perform that action at this time.
0 commit comments