Skip to content

Commit

Permalink
Core.Tests: add failing test for UsedUnderscorePrefixedElements
Browse files Browse the repository at this point in the history
Added failing test for UsedUnderscorePrefixedElements rule when
variable with name beginning with _ is used, but not
immediately after declaration.
  • Loading branch information
webwarrior-ws committed Dec 20, 2023
1 parent 3443a6a commit 9f8454c
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ module MyModule =

Assert.IsTrue this.ErrorsExist

[<Test>]
member this.``Use variable with underscore prefix but not immediately after declaration``() =
this.Parse """
module MyModule =
let MyFunc () =
let _random = System.Random()
()
()
_random"""

Assert.IsTrue this.ErrorsExist

[<Test>]
member this.``Use variable with underscore prefix inside some expression``() =
this.Parse """
module MyModule =
let MyFunc () =
let _random = System.Random()
"someString" + _random.ToString()"""

Assert.IsTrue this.ErrorsExist

[<Test>]
member this.``Not using variable with underscore prefix``() =
this.Parse """
Expand Down

0 comments on commit 9f8454c

Please sign in to comment.