How to test clojure solution?

0 views
Skip to first unread message

Thomas

unread,
Apr 20, 2010, 1:22:50 PM4/20/10
to coding kata
I'm not sure how to test clojure solutions. I tried the simple hello
world simply by writing

(ns org.codingkata.unit.MyKata
(:import (org.codingkata.unit.api.BaseKataSolution))
(:gen-class
:extends org.codingkata.unit.api.BaseKataSolution))


(defn reply [] "hello world")

But my test fails. How is it supposed to be written up in clojure?

Thomas


--
Subscription settings: http://groups.google.com/group/coding-kata/subscribe?hl=en

rdunklau

unread,
Apr 20, 2010, 1:49:44 PM4/20/10
to coding kata
Hello.

To tell the compiler that your reply function is indeed the the reply
method implementation, you have to prefix it with "-" , and your
function must accept an argument corresponding to the java instance of
your class (being an instance method).

So, your function definition should look like:

(defn -reply [this] "hello world")

Ronan.
Reply all
Reply to author
Forward
0 new messages