Skip to content

Use regex for description tests with non-deterministic ordering#12

Merged
Kyle-Ye merged 1 commit into
mainfrom
test/description-regex-match
Apr 15, 2026
Merged

Use regex for description tests with non-deterministic ordering#12
Kyle-Ye merged 1 commit into
mainfrom
test/description-regex-match

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Apr 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Merge descriptionMultipleAttributes / descriptionMultipleTraits into the parameterized description tests in GestureTraitCompatibilityTests and GestureTraitCollectionCompatibilityTests.
  • Drop the #expect(a == "X" || a == "Y") pattern used for non-deterministic dictionary ordering. Use a (String?, Regex<Substring>?) argument pair so deterministic cases still assert via fast == and only the order-sensitive cases pay for wholeMatch(of:) with try #require.

Test plan

  • OPENGESTURES_COMPATIBILITY_TEST=0 swift test --filter 'GestureTraitCompatibilityTests.description|GestureTraitCollectionCompatibilityTests.description' — all 11 parameter rows pass (7 trait + 4 collection).

Attribute dictionaries don't guarantee key order, so the description
tests previously matched both permutations via `||`-chained equality
and lived in separate `descriptionMultipleAttributes` /
`descriptionMultipleTraits` methods. Merge those cases into the
parameterized `description` tests with a (String?, Regex<Substring>?)
argument pair: deterministic cases still use fast `==`, and only the
non-deterministic cases pay for `wholeMatch(of:)`.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.65%. Comparing base (7422712) to head (d845394).

Files with missing lines Patch % Lines
...ityTests/Core/GestureTraitCompatibilityTests.swift 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
- Coverage   71.85%   71.65%   -0.20%     
==========================================
  Files          56       56              
  Lines        1439     1436       -3     
==========================================
- Hits         1034     1029       -5     
- Misses        405      407       +2     
Flag Coverage Δ
ios 66.96% <85.71%> (-0.25%) ⬇️
macos 71.65% <85.71%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kyle-Ye Kyle-Ye merged commit aae2b6f into main Apr 15, 2026
4 checks passed
@Kyle-Ye Kyle-Ye deleted the test/description-regex-match branch April 15, 2026 19:53
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