summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonrad Hinsen <konrad.hinsen@fastmail.net>2010-05-28 17:29:19 +0200
committerStuart Halloway <stu@thinkrelevance.com>2010-06-07 10:04:08 -0400
commit42df6a0ad721a798411e9a701d51a42f6686777f (patch)
tree7bf855b159e62c185c4f4eb1622cf9b6b49c183c
parentc2b229e6847762324398f7b7cb67b1da4e902b2c (diff)
Added testcase for defrecord with field names that used to clash with method argument names
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
-rw-r--r--test/clojure/test_clojure/protocols.clj9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/clojure/test_clojure/protocols.clj b/test/clojure/test_clojure/protocols.clj
index 78a62dae..016f9aa2 100644
--- a/test/clojure/test_clojure/protocols.clj
+++ b/test/clojure/test_clojure/protocols.clj
@@ -220,6 +220,15 @@
(is (= (r 1 4) (.cons rec [:b 4])))
(is (= (r 1 5) (.cons rec (MapEntry. :b 5))))))))
+(defrecord RecordWithSpecificFieldNames [this that k m o])
+(deftest defrecord-with-specific-field-names
+ (let [rec (new RecordWithSpecificFieldNames 1 2 3 4 5)]
+ (is (= rec rec))
+ (is (= 1 (:this (with-meta rec {:foo :bar}))))
+ (is (= 3 (get rec :k)))
+ (is (= (seq rec) '([:this 1] [:that 2] [:k 3] [:m 4] [:o 5])))
+ (is (= (dissoc rec :k) {:this 1, :that 2, :m 4, :o 5}))))
+
(deftest reify-test
(testing "of an interface"
(let [s :foo