Lean up tests: a custom matcher and shared helpers#2084
Merged
Conversation
- Add a :to-have-same-items-as custom matcher (order-independent list equality with a missing/extra failure message) and use it in place of the (sort X #'string<) :to-equal (sort ...) dance across the watch, indexing, async, consult and file-kinds specs. - Add a shared projectile-test-match-sig helper and drop the two nearly identical per-file --sig copies (scan-async, search-review). - Make the search-review --wait delegate to the shared projectile-test-wait-for pump instead of re-rolling the event loop. No behavior change; 889 specs green.
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.
First slice of a test-readability pass. Buttercup 1.38 gives us custom matchers and helper hooks we weren't using at all (zero custom matchers in the suite); this introduces the highest-leverage ones and removes some duplication.
:to-have-same-items-as- an order-independent list-equality matcher whose failure message reports the missing/extra items. Replaces the(sort X #'string<) :to-equal (sort ...)boilerplate in the watch, indexing, async, consult and file-kinds specs, e.g.projectile-test-match-sig- one shared match-signature helper, replacing the two near-identical--sigcopies in the scan-async and search-review specs.The search-review
--waitnow delegates to the existing sharedprojectile-test-wait-forpump instead of re-rolling theaccept-process-outputloop.No behavior change; 889 specs green, clean
--warnings-as-errors, relint clean.More opportunities to follow if you want them (see the PR discussion): a
with-temp-filehelper macro for the ~35make-temp-file+unwind-protectdances (mostly in the session/known-projects specs), an optional match-field matcher, and a:to-be-truthysweep.