Skip to content

Testing gaps: aligner behavior, DiffOptions, and ToString are under- or un-tested #28

Description

@lassevk

Coverage reports ~97% line / 93% branch, but that number is flattering because DiffSection, DiffElement, and DiffOptions are all marked [ExcludeFromCodeCoverage], so real logic inside them is invisible. Concrete gaps found while reviewing:

Untested behavior (not just coverage — genuinely no assertions):

  • ElementSimilarityDiffElementAligner<T> has only a null-arg constructor test (ElementSimilarityDiffElementAlignerTests.cs). Its whole CalculateBestAlignment decision logic is exercised only indirectly through StringSimilarityDiffElementAligner, and only on tiny inputs — which is why the scoring bug (see separate issue) slipped through. Add direct tests with a controllable ElementSimilarity<T> delegate: insert-vs-delete-vs-modify selection, the modification threshold boundary, and inputs above/below the punt threshold.
  • DiffOptions.ContextSize validation (throw on < 1) is untested — and the message is wrong (separate polish issue).
  • DiffOptions.EnablePatienceOptimization = false path and ContextSize > 1 are never exercised. Both change LongestCommonSubsectionDiff/LongestCommonSubsequence.Find behavior and deserve dedicated diff tests.
  • DiffSection.ToString() has five distinct branches, all [ExcludeFromCodeCoverage] and untested. If these strings matter, test them; if they don't, that's fine — but the exclusion hides it.
  • BasicReplaceInsertDeleteDiffElementAligner<T> has no direct test (only reached via MutateToBeLike).

Suggestion: reconsider the blanket [ExcludeFromCodeCoverage] on types that contain conditional logic (DiffSection.ToString, DiffOptions.ContextSize). Excluding pure data records is reasonable; excluding types with branches just hides untested logic behind a green number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions