We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 545bef0 commit 498e5a1Copy full SHA for 498e5a1
src/xitdb/hash_set.clj
@@ -16,7 +16,7 @@
16
(throw (UnsupportedOperationException. "XITDBHashSet is read-only")))
17
18
(contains [this k]
19
- (not (nil? (.getCursor rhm (util/db-key (.hashCode k))))))
+ (not (nil? (.getCursor rhm (util/db-key (if (nil? k) 0 (.hashCode k)))))))
20
21
(get [this k]
22
(when (.contains this k)
test/xitdb/set_test.clj
@@ -81,5 +81,12 @@
81
(is (= {:sweets #{:regular-candy :chupa-chups, :mochi :tiramisu}}
82
(tu/materialize @db1))))))
83
84
+(deftest nil-test
85
+ (with-db [db (tu/test-db)]
86
+ (reset! db {:sweets #{nil :mochi}})
87
+ (testing "Handles nil correctly"
88
+ (let [sweets (:sweets @db)]
89
+ (is (true? (contains? sweets nil)))))))
90
+
91
92
0 commit comments