Fix TreeNodeFilter OR-pattern diagnostics#7415
Open
Evangelink wants to merge 4 commits into
Open
Conversation
Youssef1313
suggested changes
Feb 16, 2026
This was referenced Apr 1, 2026
Member
Author
|
Merged latest Verification:
Ready for CI re-run and review. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR clarifies TreeNodeFilter behavior for OR patterns and improves diagnostics when unsupported full-path OR expressions are parenthesized.
Changes:
- Adds regression coverage for single-segment OR patterns and exact-match behavior.
- Updates TreeNodeFilter grammar remarks and propagates filter text into parser error construction.
- Improves the unexpected slash diagnostic for parenthesized full-path OR patterns.
Show a summary per file
| File | Description |
|---|---|
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Requests/TreeNodeFilterTests.cs |
Adds tests for supported OR syntax and unsupported parenthesized full-path OR diagnostics. |
src/Platform/Microsoft.Testing.Platform/Requests/TreeNodeFilter/TreeNodeFilter.cs |
Documents OR syntax limitations and augments the unexpected slash exception message. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
| throw new InvalidOperationException(PlatformResources.TreeNodeFilterUnexpectedSlashOperatorErrorMessage); | ||
| throw new InvalidOperationException( | ||
| $"{PlatformResources.TreeNodeFilterUnexpectedSlashOperatorErrorMessage} " | ||
| + $"Filter: '{filter}'. To combine alternatives for one path segment, use syntax like '/A/B/C/(X|Y)'."); |
Member
Author
There was a problem hiding this comment.
Moved the string to PlatformResources.resx as TreeNodeFilterUnexpectedSlashOperatorInPathSegmentErrorMessage so it's localized with the rest of the TreeNodeFilter diagnostics. XLFs regenerated via UpdateXlf.
The merge of origin/main into this branch brought in many new resx entries (IsGreaterThan, IsLessThan, IsPositive, IsNegative, IsInRange, Contains*, DoesNotContain*, ContainsSingle, etc.). Regenerated all 13 XLF files via 'dotnet msbuild /t:UpdateXlf' to keep them in sync. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the inline hint diagnostic appended to TreeNodeFilterUnexpectedSlashOperatorErrorMessage into a new PlatformResources entry (TreeNodeFilterUnexpectedSlashOperatorInPathSegmentErrorMessage) so the full message is localized like the surrounding parser diagnostics. XLFs regenerated via UpdateXlf. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines
+62
to
+66
| /// OR expressions are supported for a single path segment, for example: | ||
| /// <c>/A/B/C/(Test1|Test2)</c>. | ||
| /// | ||
| /// OR expressions over full paths are not supported, for example: | ||
| /// <c>(/A/B/C/Test1)|(/A/B/C/Test2)</c>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Validation
Notes
This change does not expand grammar to support full-path OR in parentheses; it adds explicit guidance and test coverage for current supported syntax.