Skip to content

Add docstrings to matcher-combinators.test declarations#236

Merged
philomates merged 4 commits into
masterfrom
clojure-test-docstrings
Jul 3, 2026
Merged

Add docstrings to matcher-combinators.test declarations#236
philomates merged 4 commits into
masterfrom
clojure-test-docstrings

Conversation

@philomates

@philomates philomates commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

I had to change the declare forms in matcher-combinators.test to defns so that the docstring would be picked up by LSP. Just adding :doc meta to the declare, like the following, doesn't seem to get picked up by the clojure LSP as far as I can tell

(require '[matcher-combinators.test :refer [match? thrown-match?]])
(declare ^{:arglists '([matcher actual]) :doc "some docstring"} match?)
(:doc (meta #'match?))

@philomates
philomates force-pushed the clojure-test-docstrings branch 2 times, most recently from 33d00a3 to 1fef66d Compare April 13, 2026 09:41
Comment on lines +32 to +36
(defn match-with?
"DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead."
[type->matcher matcher actual]
(throw (#?(:cljs js/Error. :clj AssertionError.)
"Should only be invoked within a `clojure.test/is` form")))

@teodorlu teodorlu Apr 13, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could also be helpful for users to include :deprecated "deprecated-version" metadata:

Suggested change
(defn match-with?
"DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead."
[type->matcher matcher actual]
(throw (#?(:cljs js/Error. :clj AssertionError.)
"Should only be invoked within a `clojure.test/is` form")))
(defn match-with?
"DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead."
{:deprecated "3.0.0"}
[type->matcher matcher actual]
(throw (#?(:cljs js/Error. :clj AssertionError.)
"Should only be invoked within a `clojure.test/is` form")))

This will show up in most editors that rely on clojure-lsp. My Emacs the referenced var with strikethough, and deprecated version below:

Image

@NoahTheDuke

Copy link
Copy Markdown

Looks like this is a redo of my PR #207, which i couldn't ever get to work. I'll close that one if you can get the test suite to pass.

Copilot AI review requested due to automatic review settings July 3, 2026 09:53

This comment was marked as spam.

@philomates
philomates merged commit c69bd2a into master Jul 3, 2026
5 of 7 checks passed
@philomates
philomates deleted the clojure-test-docstrings branch July 3, 2026 10:04
@teodorlu

teodorlu commented Jul 3, 2026

Copy link
Copy Markdown

Thank you! 🙏

@philomates

Copy link
Copy Markdown
Collaborator Author

released as 3.10.1

@NoahTheDuke

Copy link
Copy Markdown

thank you!

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.

4 participants