Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/clojure/core_test/parse_uuid.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
(when-var-exists clojure.core/instance?
#?(:clj (is (instance? java.util.UUID (parse-uuid "b6883c0a-0342-4007-9966-bc2dfa6b109e"))))
#?(:cljs (is (instance? cljs.core.UUID (parse-uuid "b6883c0a-0342-4007-9966-bc2dfa6b109e"))))))
(testing "tolerance to non-standard forms"
(are [expected s] (= #?(:clj expected :default nil) (parse-uuid s)) ; clj is permissive, others are strict
#uuid "00000000-0000-0000-0000-000000000000" "0-0-0-0-0"
#uuid "00000012-0034-0056-0078-000000000009" "12-34-56-78-9"
#uuid "00000005-0004-0003-0002-009000000001" "5-4-3-DEADBEEF0002-9000000001"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is really strange, great find! It may be a good idea to raise this as a separate clj bug so the language maintainers can decide whether deviating from Java's behavior here is preferred or not

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, will consider raising a bug to Clojure. (Honestly I doubt that a deviation from current behavior would happen at this point given the risk of breaking existing systems 😅 but still, it's worth noticing.)

(testing "exceptions"
#?(:clj (are [x] (thrown? Exception (parse-uuid x))
{}
Expand Down