Awesome. Thanks for the answers, everyone.
On Feb 4, 3:07 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 04.02.2009 um 23:01 schrieb Laurent PETIT:
>
> > this should work for you :
>
> > (binding [*out* (java.io.StringWriter.)]
> > (printing-fn)
> > (= (.toString *out*) "YES"))
>
> The
Hi,
Am 04.02.2009 um 23:01 schrieb Laurent PETIT:
this should work for you :
(binding [*out* (java.io.StringWriter.)]
(printing-fn)
(= (.toString *out*) "YES"))
There is also with-out-str:
(= "YES" (with-out-str (printing-fn)))
(And for the record: there is also a with-in-st
Hello,
this should work for you :
(binding [*out* (java.io.StringWriter.)]
(printing-fn)
(= (.toString *out*) "YES"))
Regards,
--
Laurent
2009/2/4 samppi
>
> I want to test if a certain function prints a certain message to the
> system's standard output. How may I go about do
I want to test if a certain function prints a certain message to the
system's standard output. How may I go about doing this?
(defn printing-fn []
(print "YES"))
(deftest test-printing-fn
(some-context-that-switches-the-default-target-of-printing
(printing-fn)
(is (= the-standard-out