File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
tests/FSharpLint.Core.Tests/Rules/Conventions/Naming Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,54 @@ type Foo() =
175175
176176 Assert.IsTrue this.NoErrorsExist
177177
178+ [<Test>]
179+ member this. ``Function without explicit type returning Async<'T> should give violations offering adding Async prefix`` () =
180+ this.Parse """
181+ module Foo =
182+ let Bar() =
183+ async { return 1 }
184+ """
185+
186+ Assert.IsTrue this.ErrorsExist
187+ StringAssert.Contains( " AsyncBar" , this.ErrorMsg)
188+
189+ [<Test>]
190+ member this. ``Function without explicit type returning Task<'T> should give violations offering adding Async suffix`` () =
191+ this.Parse """
192+ module Foo =
193+ let Bar() =
194+ task {}
195+ """
196+
197+ Assert.IsTrue this.ErrorsExist
198+ StringAssert.Contains( " BarAsync" , this.ErrorMsg)
199+
200+ [<Test>]
201+ member this. ``Function without explicit type returning Task should give violations offering adding Async suffix`` () =
202+ this.Parse """
203+ open System.Threading.Tasks
204+
205+ module Foo =
206+ let Bar() =
207+ let Baz(): Task =
208+ null
209+ Baz()
210+ """
211+
212+ Assert.IsTrue this.ErrorsExist
213+ StringAssert.Contains( " BarAsync" , this.ErrorMsg)
214+
215+ [<Test>]
216+ member this. ``Method without explicit type returning Async<'T> should give violations offering adding Async prefix`` () =
217+ this.Parse """
218+ type Foo() =
219+ member this.Bar() =
220+ async { return 1 }
221+ """
222+
223+ Assert.IsTrue this.ErrorsExist
224+ StringAssert.Contains( " AsyncBar" , this.ErrorMsg)
225+
178226[<TestFixture>]
179227type TestAsynchronousFunctionNamesAllAPIs () =
180228 inherit TestAstNodeRuleBase.TestAstNodeRuleBase( AsynchronousFunctionNames.rule { Mode = AllAPIs })
You can’t perform that action at this time.
0 commit comments