Skip to content

Commit

Permalink
Tests: fix errors in CyclomaticComplexity tests
Browse files Browse the repository at this point in the history
Fix errors in CyclomaticComplexity tests cause by incorrect
indentation of generated code.
  • Loading branch information
webwarrior-ws committed Mar 5, 2024
1 parent ac20c53 commit 9e5f360
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ let f() =
member this.EnsureComplexityOfFunctionsAreIndependent() =
let code = $"""Module Program
let f() =
{makeMatchSnippet (MaxComplexity + 1) |> indent 4}
{makeMatchSnippet (MaxComplexity + 1) |> indent 4}
let g() =
{makeMatchSnippet MaxComplexity |> indent 4}"""
{makeMatchSnippet MaxComplexity |> indent 4}"""
this.Parse code
Assert.AreEqual(1, this.ErrorRanges.Length)
Assert.IsTrue(this.ErrorExistsAt(2, 4))
Expand All @@ -226,10 +226,11 @@ let f() =
/// Verifies that the cyclomatic complexity is calculated on nested functions independently by checking that a nested function that comes after another nested function with a cyclomatic complexity that is flagged as too high need not be flagged.
[<Test>]
member this.EnsureComplexityOfNestedFunctionsAreIndependent() =
let gSnippet = makeMatchSnippet (MaxComplexity+1) |> indent 8
let code = $"""Module Program
let f() =
let g() =
{(makeMatchSnippet (MaxComplexity+1)) |> indent 8}
{gSnippet}
let h() =
{makeMatchSnippet MaxComplexity |> indent 8}
{makeMatchSnippet (MaxComplexity+1) |> indent 4}"""
Expand Down

0 comments on commit 9e5f360

Please sign in to comment.