Skip to content

Add tests for with-meta - #953

Open
phtrivier wants to merge 3 commits into
jank-lang:mainfrom
phtrivier:phtrivier/clojure.core/with-meta
Open

Add tests for with-meta#953
phtrivier wants to merge 3 commits into
jank-lang:mainfrom
phtrivier:phtrivier/clojure.core/with-meta

Conversation

@phtrivier

Copy link
Copy Markdown
Contributor

Closes #580

I locally ran tests for:

  • jvm
  • cljs (the implementation of the edge case where the map passed to with-meta is not really a map is different from the jvm case)
  • cljr (with dotnet 9.0, some other tests are failing but this test works)
  • bb

I failed to install the other runtimes :/

@phtrivier

Copy link
Copy Markdown
Contributor Author

@jeaye for your consideration (can't mark you as reviewer, sorry for the noise.)

@jeaye jeaye left a comment

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.

Hi! Thanks for the PR. In our other tests, we've been more exhaustive about supported types and I think that would be useful here, too.

Comment on lines +10 to +11
{:a 0} {} {:a 0}
{:a 0} ^:b {} {:a 0} ;; with-meta overrides existing metadata

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.

There are a lot of types which support meta aside from just array maps. We should enumerate these, since the ones which support it should be consistent across dialects. For example, namespaces, vars, functions, symbols, vectors, lists, sets, hash maps, and various sequences.

@dgr What do you think about being exhaustive here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Forgive me for a drive-by comment. But I think issue #921 is also of interest

@jeaye
jeaye requested review from E-A-Griffin and dgr and a lite review from Copilot August 31, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 file covering clojure.core/with-meta behavior across supported dialects (guarded by when-var-exists), including basic metadata application and an edge-case around non-map metadata values.

Changes:

  • Introduces test/clojure/core_test/with_meta.cljc with with-meta test cases for setting/overriding metadata.
  • Adds a dialect-conditional expectation for the “non-map metadata” edge case (CLJS vs other runtimes).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists] :as p]))

(when-var-exists with-meta
(deftest test-with_meta
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/with-meta

4 participants