Skip to content

feat: add IgnoringInterspersedItems option for collections#646

Merged
vbreuss merged 1 commit intomainfrom
topic/support-ignoringintersperseditems-option
Jun 20, 2025
Merged

feat: add IgnoringInterspersedItems option for collections#646
vbreuss merged 1 commit intomainfrom
topic/support-ignoringintersperseditems-option

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Jun 20, 2025

This PR introduces a new IgnoringInterspersedItems option for collection matchers, allowing expected items to be matched in order while skipping any extra items between them. Key changes include:

  • API extensions to expose IgnoringInterspersedItems() on expectation/result builders.
  • Core logic updates in CollectionMatchOptions and various CollectionMatcher implementations to honor interspersed-item skipping.
  • Extensive updates to existing tests to adjust error messages when all expected items are missing.

With this option enabled additional items between the expected items are skipped and do not result in a failure.
@vbreuss vbreuss self-assigned this Jun 20, 2025
Copilot AI review requested due to automatic review settings June 20, 2025 16:46
@vbreuss vbreuss added the enhancement New feature or request label Jun 20, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new IgnoringInterspersedItems option for collection matchers, allowing expected items to be matched in order while skipping any extra items between them. Key changes include:

  • API extensions to expose IgnoringInterspersedItems() on expectation/result builders.
  • Core logic updates in CollectionMatchOptions and various CollectionMatcher implementations to honor interspersed-item skipping.
  • Extensive updates to existing tests to adjust error messages when all expected items are missing.

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Source/aweXpect.Core/Options/CollectionMatchOptions.cs Added _ignoringInterspersedItems flag, extended matcher selection and expectation formatting.
Source/aweXpect.Core/Options/*CollectionMatcher.cs Updated same‐order matchers to support interspersed-item skipping with a new parameter and tracking.
Source/aweXpect/Results/*CollectionMatchResult.cs Added IgnoringInterspersedItems() methods and XML docs.
Source/aweXpect.Core/Core/Helpers/ExceptionHelpers.cs Introduced IsDefault<T> extension for detecting default struct values.
Tests/aweXpect.Tests/Collections/** Updated expected exception messages in dozens of tests to reflect the new phrasing.
Tests/aweXpect.Core.Api.Tests/Expected/** and Tests/aweXpect.Api.Tests/Expected/** Added IgnoringInterspersedItems() to API expectation snapshots.
Pipeline/Build.cs Changed BuildScope from Default to CoreOnly.
Comments suppressed due to low confidence (1)

Pipeline/Build.cs:22

  • [nitpick] Switching the build scope to CoreOnly may prevent packaging or publishing other components. Please verify this change is intentional and update the comment to reflect the narrower scope.
	readonly BuildScope BuildScope = BuildScope.CoreOnly;

Comment thread Source/aweXpect.Core/Options/CollectionMatchOptions.cs
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 20, 2025

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

    4 files      4 suites   22s ⏱️
  888 tests   887 ✅ 1 💤 0 ❌
2 550 runs  2 549 ✅ 1 💤 0 ❌

Results for commit 375f3e8.

@vbreuss vbreuss merged commit eb680f7 into main Jun 20, 2025
13 checks passed
@vbreuss vbreuss deleted the topic/support-ignoringintersperseditems-option branch June 20, 2025 19:22
@github-actions
Copy link
Copy Markdown
Contributor

This is addressed in release v2.17.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to allow interspersed items in collection comparison

2 participants