Skip to content

Add tests for map#889

Merged
jeaye merged 4 commits into
jank-lang:mainfrom
dgr:dgr-map
May 21, 2026
Merged

Add tests for map#889
jeaye merged 4 commits into
jank-lang:mainfrom
dgr:dgr-map

Conversation

@dgr
Copy link
Copy Markdown
Collaborator

@dgr dgr commented May 20, 2026

Closes #351

@dgr dgr requested review from E-A-Griffin and jeaye May 20, 2026 04:18
Comment thread test/clojure/core_test/map.cljc Outdated
Comment thread test/clojure/core_test/map.cljc Outdated
Comment on lines +28 to +29
(is (and (p/lazy-seq? try-nil) (empty? try-nil)))
(is (and (p/lazy-seq? try-empty-list) (empty? try-empty-list))))
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.

I think checking lazy-seq? here is redundant but won't block on it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This one I think is valid. I want to ensure that even with an empty or nil list, the return value of map is still a lazy seq. That is, no shortcuts being taken where the implementation just returns the empty list or nil.

Comment thread test/clojure/core_test/map.cljc
Copy link
Copy Markdown
Collaborator

@E-A-Griffin E-A-Griffin left a comment

Choose a reason for hiding this comment

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

Left some suggestions

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

This PR adds a new core test namespace to cover clojure.core/map behavior across arities and common edge cases, addressing issue #351.

Changes:

  • Adds test-map coverage for map arities 1 (transducer) through 5+ (multiple input seqs).
  • Adds checks for laziness/realization, termination at shortest input, and behavior on nil/empty inputs.
  • Adds negative-case assertions for non-seqable inputs.

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

Comment thread test/clojure/core_test/map.cljc Outdated
@dgr
Copy link
Copy Markdown
Collaborator Author

dgr commented May 20, 2026

I also added a test case where some of the collections are infinite ranges, to validate that it doesn't try to realize them fully.

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.

Great work, Dave!

Comment thread test/clojure/core_test/map.cljc
Comment thread test/clojure/core_test/map.cljc Outdated
@dgr
Copy link
Copy Markdown
Collaborator Author

dgr commented May 21, 2026

Added lots of infinite ranges. Did not convert to doall from seq. If you want me to do that, let me know.

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.

Phew! Excellent work, Dave.

@jeaye jeaye merged commit 2b5d20f into jank-lang:main May 21, 2026
5 checks passed
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/map

4 participants