From bbc0f5375b80ab825e91e9e2a4240a482a3dfc8b Mon Sep 17 00:00:00 2001 From: Tuomas Hietanen Date: Sun, 2 Nov 2025 14:52:11 +0000 Subject: [PATCH] Added 2 missing unit-tests for member length in SourceLength --- .../Rules/Conventions/SourceLength.fs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/FSharpLint.Core.Tests/Rules/Conventions/SourceLength.fs b/tests/FSharpLint.Core.Tests/Rules/Conventions/SourceLength.fs index 6ed14cc08..747656e53 100644 --- a/tests/FSharpLint.Core.Tests/Rules/Conventions/SourceLength.fs +++ b/tests/FSharpLint.Core.Tests/Rules/Conventions/SourceLength.fs @@ -230,7 +230,29 @@ let MemberLength = 70 [] type TestMaxLinesInMember() = inherit TestAstNodeRuleBase.TestAstNodeRuleBase(MaxLinesInMember.rule { Config.MaxLines = MemberLength }) - // TODO: Add tests. + [] + member this.MemberTooManyLines() = + this.Parse $""" +module Program + +type Class() = + member this.Member1 () = + %s{generateNewLines MemberLength 8} + () +\"\"\") + + Assert.IsTrue(this.ErrorExistsAt(5, 4)) + + [] + member this.MemberNotTooManyLines() = + this.Parse \"\"\" +module Program + +type Class() = + member this.Member1 () = () +\"\""" + + Assert.IsFalse(this.ErrorExistsAt(5, 4)) [] let PropertyLength = 70