diff options
Diffstat (limited to 'test/clojure/test_clojure')
-rw-r--r-- | test/clojure/test_clojure/protocols.clj | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/clojure/test_clojure/protocols.clj b/test/clojure/test_clojure/protocols.clj index 32dbf812..90de0010 100644 --- a/test/clojure/test_clojure/protocols.clj +++ b/test/clojure/test_clojure/protocols.clj @@ -82,7 +82,13 @@ (let [obj (reify ExampleProtocol (baz [a b] "two-arg baz!"))] (is (= "two-arg baz!" (baz obj nil))) - (is (thrown? AbstractMethodError (baz obj)))))) + (is (thrown? AbstractMethodError (baz obj))))) + (testing "you can redefine a protocol with different methods" + (eval '(defprotocol Elusive (old-method [x]))) + (eval '(defprotocol Elusive (new-method [x]))) + (is (= :new-method (eval '(new-method (reify Elusive (new-method [x] :new-method)))))) + (is (fails-with-cause? IllegalArgumentException #"No method of interface: user\.Elusive found for function: old-method of protocol: Elusive \(The protocol method may have been defined before and removed\.\)" + (eval '(old-method (reify Elusive (new-method [x] :new-method)))))))) (deftype ExtendTestWidget [name]) (deftype HasProtocolInline [] |