<div dir="ltr"><div><div><div><div>This Stackoverflow give a lot of hints: <a href="http://stackoverflow.com/questions/7370073/testing-functions-in-haskell-that-do-io">http://stackoverflow.com/questions/7370073/testing-functions-in-haskell-that-do-io</a><br><br></div>You cannot "Unit" test functions that performs, because by definition a unit test is about testing an isolated piece of code that give the same result for the same input, i.e. pure.<br></div>In my programs I separate the non-IO parts for the IO parts, so that I can test the non-IO parts.<br></div>The IO parts are mainly the GUI parts of my apps, which I test manually.<br><br></div>Now it should be possible to trick the IO monad by supplying always the same user input to your function, but I don't know how to do that.<br><div><br><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 24, 2014 at 4:22 PM, martin <span dir="ltr"><<a href="mailto:martin.drautzburg@web.de" target="_blank">martin.drautzburg@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
<br>
in order to nail down my problem state in "Replacing the world in a State Machine with IO", I'd like to answer a much<br>
simpler question:<br>
<br>
If I have function which reads IO and I want to test this function by passing it a series of pure values, how would I do<br>
this? I suppose I can do this by splitting my function in two, such that the outer function does IO and the inner is a<br>
pure function. Is there any other way?<br>
<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>