Skip to content

Commit 8fbe79e

Browse files
committed
Tests: 2 tests 4 NoAsyncRunSynchronouslyInLibrary
Added 2 more tests for NoAsyncRunSynchronouslyInLibrary rule.
1 parent 6b100ee commit 8fbe79e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/FSharpLint.Core.Tests/Rules/Conventions/NoAsyncRunSynchronouslyInLibrary.fs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ let main () =
3434

3535
this.AssertNoWarnings()
3636

37+
[<Test>]
38+
member this.``Async.RunSynchronously may be used in code module that has function with entry point``() =
39+
this.Parse("""
40+
module Program
41+
42+
let foo () =
43+
async {
44+
return ()
45+
}
46+
|> Async.RunSynchronously
47+
48+
[<EntryPoint>]
49+
let main () =
50+
0""")
51+
52+
this.AssertNoWarnings()
53+
3754
[<Test>]
3855
member this.``Async.RunSynchronously may be used in NUnit test code``() =
3956
this.Parse("""
@@ -65,3 +82,22 @@ type FooTest () =
6582
|> Async.RunSynchronously""")
6683

6784
this.AssertNoWarnings()
85+
86+
[<Test>]
87+
member this.``Async.RunSynchronously may be used in module with tests``() =
88+
this.Parse("""
89+
module Program
90+
91+
let foo () =
92+
async {
93+
return ()
94+
}
95+
|> Async.RunSynchronously
96+
97+
[<TestClass>]
98+
type FooTest () =
99+
[<TestMethod>]
100+
member this.Foo() =
101+
()""")
102+
103+
this.AssertNoWarnings()

0 commit comments

Comments
 (0)