Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add tests for protocol-related stuff.

Can't come up with a test that actually fails, but something in the
jiraph STM layer does fail.
  • Loading branch information...
commit a9fd0d49d92b88e190db3ca400e76d664c259f14 1 parent 014694d
@amalloy amalloy authored
Showing with 19 additions and 1 deletion.
  1. +19 −1 test/useful/datatypes_test.clj
View
20 test/useful/datatypes_test.clj
@@ -4,6 +4,20 @@
(defrecord Test [a b c])
(record-accessors Test)
+
+(defprotocol Inline
+ (foo [this]))
+(defprotocol Dynamic
+ (bar [this]))
+
+(defrecord Implementor [x]
+ Inline
+ (foo [this] "x"))
+
+(extend-type Implementor
+ Dynamic
+ (bar [this] "y"))
+
(deftest test-record
(let [init (Test. 1 2 3)
second (Test. 1 5 4)]
@@ -22,4 +36,8 @@
(let [times-evaled (atom 0)
r (Test. 1 2 3)]
(assoc-record ^Test (do (swap! times-evaled inc) r) :a :x :b :y :c :z)
- (is (= 1 @times-evaled))))))
+ (is (= 1 @times-evaled))))
+
+ (testing "Works with implemented protocols"
+ (let [r (Implementor. 1)]
+ (assoc-record r :x 5)))))
Please sign in to comment.
Something went wrong with that request. Please try again.