mr / ftp-client

Haskell FTP client
7 stars 15 forks source link

Write tests #10

Open mr opened 7 years ago

mr commented 7 years ago

Don't know how to test this since it's like entirely IO and making sockets and stuff. But some tests would be nice.

senofsky commented 4 years ago

Do you have any ideas on how to implement this? I recently went through https://functor.tokyo/blog/2015-11-20-testing-db-access and thought it may be applicable. I'd like to help if you'd be willing.

mr commented 4 years ago

I did actually write one test here: https://github.com/mr/ftp-client/blob/master/ftp-client/test/test.hs

Basically I have a handle that performs the important IO actions and the tests use a special implementation that doesn't do anything aside from record how it's called and return predetermined responses. It would be nice if this was more robust but I don't know if there's a more general solution out there. In the meantime maybe there's a way to clean that up and just write more use cases.