Extract pure matching helpers from QuickAccessMatcher for unit testing#3904
Merged
vogella merged 1 commit intoeclipse-platform:masterfrom Apr 21, 2026
Merged
Conversation
Contributor
0a47d2d to
ef3c5ed
Compare
Move pattern building (whitespace, wildcard, safeCompile) and the substring match-quality computation out of QuickAccessMatcher into a new package-private QuickAccessMatching class with pure static methods. QuickAccessMatcher delegates to the new helpers and keeps its per-instance pattern cache. Behaviour is preserved. Add a new JUnit 5 test, QuickAccessMatchingTest, that exercises the extracted logic without a workbench harness: exact/prefix/substring quality tiers, whitespace and wildcard pattern construction, case-insensitivity, consecutive-star squashing, and the safeCompile fallback for invalid regexes. Wire it into QuickAccessTestSuite. Why this matters: the existing quick-access tests (ContentMatchesTest, QuickAccessDialogTest) all open a real QuickAccessDialog, start a workbench window, and poll results with DisplayHelper.waitForCondition using 3000-5000 ms timeouts, on top of a one-time workbench-startup tax for the whole tests bundle. Measured locally, the 12 new pure tests run in 44 ms total (about 3.7 ms per test) via the JUnit console launcher. Beyond the speedup, the new tests run in any plain JVM: no UI harness, no Display, no X server, and no timing-based flakes. This makes it practical to add broad coverage for matcher rules (ranking tiers, wildcard edge cases, regex-compilation safety) that were previously only covered indirectly through the dialog.
ef3c5ed to
c7fe4bb
Compare
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.
Summary
safeCompile) and the substring match-quality computation out ofQuickAccessMatcherinto a new package-privateQuickAccessMatchingclass of pure static functions.QuickAccessMatcherdelegates to the helpers and keeps its per-instance pattern cache; behaviour is preserved.QuickAccessMatchingTest(12 tests) covering substring quality tiers (perfect / excellent / good / partial / miss), whitespace and wildcard pattern construction, case-insensitivity, consecutive-star squashing, and thesafeCompilefallback for invalid regex. Wired intoQuickAccessTestSuite.Why
The existing quick-access tests (
ContentMatchesTest,QuickAccessDialogTest) all open a realQuickAccessDialog, start a workbench window, and poll the results table withDisplayHelper.waitForConditionusing 3000-5000 ms timeouts, on top of a one-time workbench-startup tax for the whole tests bundle. That makes adding broad coverage for matcher rules expensive and flake-prone, so the existing suite only touches ranking indirectly through the dialog.Measured locally, the 12 new pure tests run in 44 ms total (about 3.7 ms per test) via the JUnit console launcher. Beyond the speedup, the new tests need no
Display, no X server, and no UI harness, so they cannot flake on timing. This opens the door to covering more matcher rules (tier boundaries, wildcard edge cases, regex safety) as pure unit tests.Test plan
mvn compilefororg.eclipse.ui.workbenchandorg.eclipse.ui.testssucceeds.QuickAccessMatchingTestpasses directly via the JUnit 5 console launcher (12/12 in 44 ms) against the freshly built classes.QuickAccessTestSuite(including the new test class) green.*/?wildcards, multi-word filter.Note: under
-Pbuild-individual-bundles, Tycho resolvesorg.eclipse.ui.workbenchfrom the p2 target platform at test runtime, so the new class is not visible to that profile's surefire run. CI and PDE launches build the workbench from the workspace and pick it up.