-
Notifications
You must be signed in to change notification settings - Fork 23
test conj #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
test conj #768
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
| [clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]])) | ||
|
|
||
| (when-var-exists conj | ||
| (deftest test-conj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can have a test for adding to the front of an infinite seq. For example (conj (range) -1)) is valid.
| (is (= '(\f \e \d \a \b \c) (conj '(\a \b \c) \d \e \f))) | ||
| (is (= [[1 2] [3 4] [5 6]] (conj [[1 2] [3 4]] [5 6]))) | ||
| (is (= {:a 0 :b 1} (conj {:a 0} [:b 1]))) | ||
| (is (= {:a 0 :b 1} (conj {:a 0} {:b 1}))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing map keys can also be updated. (conj {:a 0} {:a 1}), for example.
| (is (thrown? js/Error (conj :a :b))) | ||
| (is (thrown? js/Error (conj {:a 0} '(:b 1))))] | ||
|
|
||
| :default [(is (thrown? Exception (conj "a" "b"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this one for CLJS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't include one because in cljs a character is a string, so the test (is (thrown? js/Error (conj \a \b))) basically covers strings as well. Another test with strings seemed a bit redundant, but I can include it if you want
closes #201