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
This commit is contained in:
parent
40505491f8
commit
92c7f8b2f0
@ -30,6 +30,10 @@
|
|||||||
(= "Simba eats animals."
|
(= "Simba eats animals."
|
||||||
(diet {:species "lion" :name "Simba" :age 1 :eater :carnivore}))
|
(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"
|
"You may use a default method when no others match"
|
||||||
(= "I don't know what Rich Hickey eats."
|
(= "I don't know what Rich Hickey eats."
|
||||||
(diet {:name "Rich Hickey"})))
|
(diet {:name "Rich Hickey"})))
|
||||||
|
Loading…
Reference in New Issue
Block a user