From 92c7f8b2f0d58680044cd665c8e4f76ca4d03f40 Mon Sep 17 00:00:00 2001 From: Tobias Pfeiffer Date: Sat, 26 Oct 2013 19:00:21 +0200 Subject: [PATCH] Added one test to the polymorph suite (test name usage) * added one tests that verifies that the diet function also accesses the name value of the map (before it was possible to just return "Bambi eats veggies." for the herbivore diet * since this is not the main purpose of these specs added just this one and not extra specs for default/carnivore as I didn't want to bloat it, but could add those as well if desired --- src/koans/09_runtime_polymorphism.clj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/koans/09_runtime_polymorphism.clj b/src/koans/09_runtime_polymorphism.clj index a8171ee..300d52a 100644 --- a/src/koans/09_runtime_polymorphism.clj +++ b/src/koans/09_runtime_polymorphism.clj @@ -30,6 +30,10 @@ (= "Simba eats animals." (diet {:species "lion" :name "Simba" :age 1 :eater :carnivore})) + "Animals have different names" + (= "Thumper eats veggies." + (diet {:species "rabbit" :name "Thumper" :age 1 :eater :herbivore})) + "You may use a default method when no others match" (= "I don't know what Rich Hickey eats." (diet {:name "Rich Hickey"})))