Skip to content

test: Add comprehensive test coverage for matchesPattern built-in function - #3499

Merged
xuzhg merged 1 commit into
dev-9.xfrom
feature/add-matchespattern-filter-tests
Mar 9, 2026
Merged

test: Add comprehensive test coverage for matchesPattern built-in function#3499
xuzhg merged 1 commit into
dev-9.xfrom
feature/add-matchespattern-filter-tests

Conversation

@xuzhg

@xuzhg xuzhg commented Mar 9, 2026

Copy link
Copy Markdown
Member

'MatchesPattern' function call was added at #2519.

This PR is to add more test cases to verify the changes.

New Test Cases:

FunctionCallBinderTests.cs - MatchesPatternFunctionBindsCorrectly: Tests binder layer binding, validates two string parameters, verifies Edm.Boolean return type

FilterAndOrderByFunctionalTests.cs - MatchesPatternInFilterWithTheReturnType: Tests complete filter parsing pipeline with Name property, query: matchesPattern(Name, '^[A-Z][a-z]+dollar'), validates property access and pattern parameters

FilterAndOrderByFunctionalTests.cs - MatchesPatternInFilterWithBooleanComparison: Tests matchesPattern in boolean expression, query: matchesPattern(Name, '[0-9]+') eq true

Coverage: Binder layer, filter parser end-to-end, property access parameters, literal patterns, boolean expressions, return type validation. matchesPattern was added in commit 023bede (PR #2519) by Avi Levin on Oct 24, 2022.

Issues

This pull request fixes #xxx.

Description

Briefly describe the changes of this pull request.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.

Repository notes

Team members can start a CI build by adding a comment with the text /AzurePipelines run to a PR. A bot may respond indicating that there is no pipeline associated with the pull request. This can be ignored if the build is triggered.

Team members should not trigger a build this way for pull requests coming from forked repositories. They should instead trigger the build manually by setting the "branch" to refs/pull/{prId}/merge where {prId} is the ID of the PR.

@xuzhg
xuzhg requested a review from Copilot March 9, 2026 18:23
@xuzhg

xuzhg commented Mar 9, 2026

Copy link
Copy Markdown
Member Author

/AzurePipelines run

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds additional unit and functional tests to validate matchesPattern binding and end-to-end filter parsing behavior in OData URI parsing, expanding coverage since the original feature addition.

Changes:

  • Add a new FunctionCallBinderTests test for binding matchesPattern.
  • Add two new FilterAndOrderByFunctionalTests cases covering return type and boolean comparison scenarios for matchesPattern.

Reviewed changes

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

File Description
test/UnitTests/Microsoft.OData.Core.Tests/UriParser/Binders/FunctionCallBinderTests.cs Adds a binder-layer unit test intended to validate matchesPattern binding and parameter typing.
test/UnitTests/Microsoft.OData.Core.Tests/ScenarioTests/UriParser/FilterAndOrderByFunctionalTests.cs Adds end-to-end filter parsing tests for matchesPattern and boolean comparison usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ction

New Test Cases:

FunctionCallBinderTests.cs - MatchesPatternFunctionBindsCorrectly: Tests binder layer with Name property access, validates two parameters (property + pattern), verifies Edm.Boolean return type with email validation regex

FilterAndOrderByFunctionalTests.cs - MatchesPatternInFilterWithTheReturnType: Tests complete filter parsing pipeline, query: matchesPattern(Name, '^[A-Z][a-z]+'), validates property access and pattern parameters

FilterAndOrderByFunctionalTests.cs - MatchesPatternInFilterWithBooleanComparison: Tests matchesPattern in boolean expression, query: matchesPattern(Name, '[0-9]+') eq true, validates function in binary operator context

Coverage: Binder layer, filter parser end-to-end, property access parameters, literal patterns, boolean expressions, return type validation. matchesPattern was added in commit 023bede (PR #2519)
@xuzhg
xuzhg force-pushed the feature/add-matchespattern-filter-tests branch from a7a7ea1 to 77f237c Compare March 9, 2026 18:33
@xuzhg
xuzhg requested a review from Copilot March 9, 2026 18:33
@xuzhg

xuzhg commented Mar 9, 2026

Copy link
Copy Markdown
Member Author

/AzurePipelines run

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xuzhg
xuzhg merged commit 6dade4f into dev-9.x Mar 9, 2026
5 of 6 checks passed
@xuzhg
xuzhg deleted the feature/add-matchespattern-filter-tests branch March 9, 2026 21:38
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