Skip to content

Conversation

@waheez
Copy link
Contributor

@waheez waheez commented Aug 2, 2025

Description of Change

This PR adds missing unit test coverage for the ListToStringConverter when handling whitespace-only strings.

The ListToStringConverter correctly filters out strings that are null, empty, or contain only whitespace characters (as implemented in line 40 of the converter), but there were no unit tests verifying this behavior for whitespace-only strings like spaces, tabs, and newlines.

Changes:

  • Added 3 new test cases to verify whitespace-only strings are properly filtered out
  • Covers spaces, tabs, and newlines as edge cases
  • Improves test coverage without changing functionality

Test Cases Added:

  • ["A", " ", "C"]"A,C" (spaces)
  • ["A", "\t", "C"]"A,C" (tabs)
  • ["A", "\n", "C"]"A,C" (newlines)

Linked Issues

  • Fixes # (This is a test coverage improvement, not a bug fix)

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal
    • Note: This is a test coverage improvement, not a bug fix or new feature
  • Has tests (if omitted, state reason in description)
    • Added: 3 new unit tests for whitespace-only strings
  • Has samples (if omitted, state reason in description)
    • Omitted: This is a test-only change, no samples needed
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls
    • Omitted: This is a test-only change, no documentation needed

Additional information

Platforms tested: N/A (unit tests only)

Type of change: Test coverage improvement

Impact: Low risk - only adds unit tests, no functional changes

* Removed unnecessary blank line in TextCaseConverter.shared.cs.
* Added test cases to ListToStringConverterTests to handle strings with whitespace characters.
@waheez
Copy link
Contributor Author

waheez commented Aug 2, 2025

@dotnet-policy-service agree

@TheCodeTraveler TheCodeTraveler enabled auto-merge (squash) August 2, 2025 22:32
@TheCodeTraveler TheCodeTraveler merged commit 9f16c1c into CommunityToolkit:main Aug 2, 2025
11 checks passed
@waheez waheez deleted the add-whitespace-tests-listtostringconverter branch August 3, 2025 01:21
@github-actions github-actions bot locked and limited conversation to collaborators Aug 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants