Browse files

Added testcase for defrecord with field names that used to clash with…

… method argument names

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information...
1 parent c2b229e commit 42df6a0ad721a798411e9a701d51a42f6686777f @khinsen khinsen committed with stuarthalloway May 28, 2010
Showing with 9 additions and 0 deletions.
  1. +9 −0 test/clojure/test_clojure/protocols.clj
View
9 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

0 comments on commit 42df6a0

Please sign in to comment.