Skip to content

Add tests for remove#880

Open
E-A-Griffin wants to merge 2 commits into
jank-lang:mainfrom
E-A-Griffin:egriffin/remove
Open

Add tests for remove#880
E-A-Griffin wants to merge 2 commits into
jank-lang:mainfrom
E-A-Griffin:egriffin/remove

Conversation

@E-A-Griffin
Copy link
Copy Markdown
Collaborator

This closes #451

@jeaye jeaye requested a review from dgr May 15, 2026 01:20
Copy link
Copy Markdown
Member

@jeaye jeaye left a comment

Choose a reason for hiding this comment

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

Thanks, Emma!

(testing "pred returning nil keeps the item"
(is (= '(nil false) (remove identity [nil true false 0 ""]))))
(is (= #{:b :c :d :e} (into #{} (remove #{:a} #{:a :b :c :d :e}))))
(is (= #{:b :c :d :e} (into #{} (remove #{:a} #{:a :b :c :d :e})))))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think a couple of good tests:

  1. nil collection
  2. Infinite collection

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yea, infinite collection is particularly important to ensure it remains lazy.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new core test namespace to cover clojure.core/remove, addressing the missing coverage reported in issue #451.

Changes:

  • Introduces clojure.core-test.remove with transducer and 2-arity remove behavioral tests.
  • Adds exception-case coverage for invalid predicate and invalid collection argument types, using portable p/thrown? assertions.

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

""
#""
0
[]))
Comment thread test/clojure/core_test/remove.cljc Outdated
Copy link
Copy Markdown
Collaborator

@dgr dgr left a comment

Choose a reason for hiding this comment

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

Overall, looks good. A couple changes.

Comment thread test/clojure/core_test/remove.cljc Outdated
(testing "pred returning nil keeps the item"
(is (= '(nil false) (remove identity [nil true false 0 ""]))))
(is (= #{:b :c :d :e} (into #{} (remove #{:a} #{:a :b :c :d :e}))))
(is (= #{:b :c :d :e} (into #{} (remove #{:a} #{:a :b :c :d :e})))))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yea, infinite collection is particularly important to ensure it remains lazy.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

clojure.core/remove

4 participants