Skip to content

Commit e210eb4

Browse files
committed
FavourStaticEmptyFields: added test for false negative
When empty string literal is inside function call that itself is inside record initialization.
1 parent 31f2c45 commit e210eb4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ type Person =
118118
Assert.IsTrue this.ErrorsExist
119119
Assert.IsTrue (this.ErrorMsg.Contains "String.Empty")
120120

121+
[<Test>]
122+
member this.FavourStaticEmptyFieldsShouldProduceError13() =
123+
this.Parse """
124+
let foo =
125+
{
126+
Range = Range.mkRange "" pos pos
127+
}"""
128+
129+
Assert.IsTrue this.ErrorsExist
130+
Assert.IsTrue (this.ErrorMsg.Contains "String.Empty")
131+
121132
[<Test>]
122133
member this.FavourStaticEmptyFieldsShouldNotProduceError1() =
123134
this.Parse "let bar = String.Empty"

0 commit comments

Comments
 (0)