File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
tests/FSharpLint.Core.Tests/Rules/Conventions/Naming Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,42 @@ module Bar =
175175
176176 Assert.IsTrue this.NoErrorsExist
177177
178+ [<Test>]
179+ member this. ``Function AsyncBar without explicit type should give violations offering creation of BarAsync`` () =
180+ this.Parse """
181+ module Foo =
182+ let AsyncBar() =
183+ async { return 0 }
184+ """
185+
186+ Assert.IsTrue this.ErrorsExist
187+ StringAssert.Contains( " BarAsync(): Task<int>" , this.ErrorMsg)
188+ StringAssert.Contains( " Async.StartAsTask(AsyncBar())" , this.ErrorMsg)
189+
190+ [<Test>]
191+ member this. ``Function BarAsync without explicit type should give violations offering creation of AsyncBar`` () =
192+ this.Parse """
193+ module Foo =
194+ let BarAsync() =
195+ task { return 1 }
196+ """
197+
198+ Assert.IsTrue this.ErrorsExist
199+ StringAssert.Contains( " AsyncBar(): Async<int>" , this.ErrorMsg)
200+ StringAssert.Contains( " async { return Async.AwaitTask (BarAsync()) }" , this.ErrorMsg)
201+
202+ [<Test>]
203+ member this. ``Functions without explicit type that comply with conventions should not give violations`` () =
204+ this.Parse """
205+ module Foo =
206+ let AsyncBar() =
207+ async { return 0 }
208+ let BarAsync() =
209+ Async.StartAsTask(AsyncBar())
210+ """
211+
212+ Assert.IsTrue this.NoErrorsExist
213+
178214[<TestFixture>]
179215type TestSimpleAsyncComplementaryHelpersAllAPIs () =
180216 inherit TestAstNodeRuleBase.TestAstNodeRuleBase( SimpleAsyncComplementaryHelpers.rule { Mode = AllAPIs })
You can’t perform that action at this time.
0 commit comments