Skip to content

Conversation

@super7ramp
Copy link
Contributor

This closes #394.

Copy link
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.

Can you test that transient operations (e.g. conj!) throw an Exception after calling persistent!, since the docstring mentions this as behavior?

@@ -1,5 +1,5 @@
(ns clojure.core-test.assoc-bang
(:require [clojure.test :refer [deftest testing are]]
(:require [clojure.test :refer [are deftest testing is]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

These should be alphabetic in the template, I'll push up a fix for this

@super7ramp
Copy link
Contributor Author

super7ramp commented Nov 10, 2025

Can you test that transient operations (e.g. conj!) throw an Exception after calling persistent!, since the docstring mentions this as behavior?

I added cases for this behavior in the tests of the transient operations. See in this PR disj! and assoc!, I'm going to add dissoc! that I forgot. conj! and pop! are not tested yet.

EDIT - added case for dissoc!

@super7ramp super7ramp force-pushed the persistent-bang branch 2 times, most recently from 76624de to 97f18a5 Compare November 10, 2025 19:14
Copy link
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.

Thank you!

#{} (transient #{})
#{nil} (transient #{nil})
#{:a :b :c} (transient #{:a :b :c})))

Copy link
Member

Choose a reason for hiding this comment

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

I think we'll want a test for calling persistent! multiple times on a transient, since that will throw. We don't need to do it for every possible shape, but we do want to capture that behavior, since it's documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, added case for this behavior.

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/persistent!

3 participants