Skip to content

Add comprehensive test coverage for four CodeFix modules - #1389

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
test-coverage-improvements-missing-keywords
Closed

Add comprehensive test coverage for four CodeFix modules#1389
github-actions[bot] wants to merge 1 commit into
mainfrom
test-coverage-improvements-missing-keywords

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

This PR significantly improves test coverage for four CodeFix modules that previously had minimal testing (1-2 test cases each). Added 23 new comprehensive test cases to provide thorough coverage of various scenarios and edge cases.

CodeFix Modules Enhanced

1. AddMissingFunKeyword (1 → 7 test cases, +6 new)

Original Coverage: Only tested basic x -> ... lambda syntax
Enhanced Coverage:

  • Multiple parameters: x y z -> ...
  • Nested expressions in List.map contexts
  • Complex expression bodies with let bindings
  • Tuple parameters: (a, b) -> ...
  • Piping contexts with filtering/mapping

2. AddMissingRecKeyword (1 → 6 test cases, +5 new)

Original Coverage: Only tested simple mutual recursion
Enhanced Coverage:

  • Pattern matching in recursive functions (isEven/isOdd)
  • Complex expressions with Fibonacci-style recursion
  • Type annotations on recursive function parameters
  • Three-way mutual recursion scenarios
  • Complex parameter handling with record updates

3. ChangeEqualsInFieldTypeToColon (2 → 8 test cases, +6 new)

Original Coverage: Basic single-line and multi-line record fields
Enhanced Coverage:

  • Complex type annotations: list<string>
  • Generic types: 'T
  • Option types: int option
  • Tuple types: int * int
  • Function types: string -> int
  • Nested records with proper indentation handling

4. ChangePrefixNegationToInfixSubtraction (1 → 7 test cases, +6 new)

Original Coverage: Only tested list slicing scenario
Enhanced Coverage:

  • Arithmetic expressions: x + y -5
  • Complex arithmetic: a * b + c -10 / 2
  • Array indexing: arr.[index..lastIndex -1]
  • Function call contexts: List.take (count -2)
  • Nested expressions in match statements
  • Variable name scenarios

Impact

  • Total new test cases: 23
  • Lines of test code added: 393
  • Coverage improvement: Comprehensive coverage for four important CodeFix modules
  • Edge cases covered: Complex expressions, type annotations, nested contexts, various syntax patterns

Test Quality

All new tests follow the existing patterns and conventions:

  • Use meaningful test case names describing the specific scenario
  • Test realistic F# code patterns that users would encounter
  • Cover both simple and complex use cases
  • Maintain proper error code expectations (10, 576, 3)
  • Use appropriate cursor positioning ($0) for CodeFix triggering

Validation

✅ Build passes successfully with dotnet build -c Release
✅ All tests follow existing patterns and conventions
✅ No coverage files included in commit (verified)

This enhancement addresses the identified gaps from the Daily Test Coverage Improvement analysis and provides solid foundation for these CodeFix modules.

AI-generated content by Daily Test Coverage Improve may contain mistakes.

…ecKeyword, ChangeEqualsInFieldTypeToColon, and ChangePrefixNegationToInfixSubtraction codefixes

- AddMissingFunKeyword: Enhanced from 1 to 7 test cases (6 new tests)
  - Added tests for multiple parameters, nested expressions, complex bodies, tuple parameters, and piping contexts
- AddMissingRecKeyword: Enhanced from 1 to 6 test cases (5 new tests)
  - Added tests for pattern matching, complex expressions, type annotations, and three-way mutual recursion
- ChangeEqualsInFieldTypeToColon: Enhanced from 2 to 8 test cases (6 new tests)
  - Added tests for complex types, generics, options, tuples, functions, and nested records
- ChangePrefixNegationToInfixSubtraction: Enhanced from 1 to 7 test cases (6 new tests)
  - Added tests for arithmetic expressions, array indexing, function calls, and nested contexts

Total: 23 new comprehensive test cases added to improve coverage of these CodeFix modules.
These modules previously had minimal test coverage with only 1-2 test cases each.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants