Skip to content

Commit

Permalink
Added testcase for defrecord with field names that used to clash with…
Browse files Browse the repository at this point in the history
… method argument names

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information
khinsen authored and stuarthalloway committed Jun 7, 2010
1 parent c2b229e commit 42df6a0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/clojure/test_clojure/protocols.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 42df6a0

Please sign in to comment.