Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed a bug...added tests

  • Loading branch information...
commit dbcd2383527f7547aeafb59cc5654a688cce8d57 1 parent 596c1fb
Timothy Baldridge authored
Showing with 7 additions and 3 deletions.
  1. +3 −1 clojure/core-multimethod.clj
  2. +4 −2 tests/core-tests.clj
4 clojure/core-multimethod.clj
View
@@ -126,7 +126,9 @@
(first bestEntry)
" and "
(first e)
- ", and neither is prefered")))))))
+ ", and neither is prefered")))
+ bestEntry))
+ bestEntry))
nil
(.getMethodTable self))]
(cond (nil? be)
6 tests/core-tests.clj
View
@@ -800,14 +800,16 @@
(defmulti bar (fn [x y] [x y]))
(defmethod bar [::rect ::shape] [x y] :rect-shape)
(defmethod bar [::shape ::rect] [x y] :shape-rect)
+(defmethod bar [::circle ::foo] [x y] :circle-foo)
(prefer-method bar [::rect ::shape] [::shape ::rect])
-
(deftest mult-method-tests
(a/assert-equal (factorial 0) 1)
(a/assert-equal (factorial 1) 1)
(a/assert-equal (factorial 3) 6)
(a/assert-equal (factorial 7) 5040)
- (a/assert-equal (bar ::rect ::rect) :rect-shape))
+ (a/assert-equal (bar ::rect ::rect) :rect-shape)
+ (a/assert-equal (bar ::shape ::rect) :shape-rect)
+ (a/assert-equal (bar ::circle ::foo) :circle-foo))
Please sign in to comment.
Something went wrong with that request. Please try again.