Skip to content

Commit af741a1

Browse files
committed
Tests(FavourStaticEmptyFields): add a failure test
1 parent 0ae7c7b commit af741a1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ let foo a =
7777
Assert.IsTrue this.ErrorsExist
7878
Assert.IsTrue (this.ErrorMsg.Contains "Array.empty")
7979

80+
[<Test>]
81+
member this.FavourStaticEmptyFieldsShouldProduceError10() =
82+
this.Parse """
83+
type Person =
84+
{
85+
FirstName: string
86+
Nicknames: List<string>
87+
}
88+
89+
{ FirstName = "Foo"; Nicknames = [] } |> ignore"""
90+
91+
Assert.IsTrue this.ErrorsExist
92+
Assert.IsTrue (this.ErrorMsg.Contains "List.Empty")
93+
8094
[<Test>]
8195
member this.FavourStaticEmptyFieldsShouldNotProduceError1() =
8296
this.Parse "let bar = String.Empty"

0 commit comments

Comments
 (0)