Skip to content

Commit 0264277

Browse files
committed
Core.Tests: add tests for function names rules
Specifically for NestedFunctionNames and UnnestedFunctionNames rules. Added test cases make sure the rule doesn't fire on bindings that are not functions.
1 parent a848a1f commit 0264277

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/FSharpLint.Core.Tests/Rules/Conventions/Naming/NestedFunctionNames.fs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,14 @@ module Program =
108108
"""
109109

110110
this.AssertNoWarnings()
111+
112+
[<Test>]
113+
member this.``Bindings that are not functions should not cause errors``() =
114+
this.Parse """
115+
module Program =
116+
let OuterFunction () =
117+
let BLUE_STATE = "blue"
118+
()
119+
"""
120+
121+
this.AssertNoWarnings()

tests/FSharpLint.Core.Tests/Rules/Conventions/Naming/UnnestedFunctionNames.fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,12 @@ module Program =
199199
"""
200200

201201
Assert.IsTrue(this.ErrorExistsAt(8, 8))
202+
203+
[<Test>]
204+
member this.``Bindings that are not functions should not cause errors``() =
205+
this.Parse """
206+
module Program =
207+
let BLUE_STATE = "blue"
208+
"""
209+
210+
this.AssertNoWarnings()

0 commit comments

Comments
 (0)