Skip to content

Commit

Permalink
fix broken UUID hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
dnolen committed Oct 13, 2015
1 parent 842cc36 commit 1440774
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/cljs/cljs/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9844,7 +9844,7 @@ Maps become Objects. Arbitrary keys are encoded to by key->js."
IHash
(-hash [this]
(when (nil? __hash)
(set! __hash (hash-string* uuid)))
(set! __hash (hash uuid)))
__hash)

IComparable
Expand Down
6 changes: 2 additions & 4 deletions src/test/cljs/cljs/core_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1690,11 +1690,9 @@
(testing "UUID hashing"
(let [id "550e8400-e29b-41d4-a716-446655440000"
uuid (cljs.core/uuid id)
expected (goog.string/hashCode id)]
expected (hash id)]
(is (= expected (hash uuid)))
;; checking hash cache
(is (= expected (.-__hash uuid)))
(is (= expected (hash uuid))))))
(is (= expected (.-__hash uuid))))))

(deftest test-comparable
(testing "Testing IComparable"
Expand Down

0 comments on commit 1440774

Please sign in to comment.