Testing - Rib

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Joel McCracken

I'd like to add some unit tests to what I am working on. Any advice? A project to look at with tests in it? I'd rather not get stuck on dealing with nix is really what I am worried about

Sridhar Ratnakumar

I don't recall every writing tests in my Haskell career :-P but generally as long as you can do these things with cabal, you don't have to worry about nix. Replace cabal ... with nix-shell --run "cabal ...". For example, nix-shell --run "cabal new-test" is probably what you want to run tests.

Sridhar Ratnakumar

You can also plainly run nix-shell (without arguments), and that'll you drop you in a bash shell. From there you can run your usual commands ("cabal new-test", "cabal sdist", "ghcid", etc.)

Sridhar Ratnakumar

example project using both nix and tests https://github.com/kowainik/relude

🌀 Relude: Reload your Prelude. Contribute to kowainik/relude development by creating an account on GitHub.
Joel McCracken

I dont usually write that many tests (at least compared to every other lang), but sometimes I do, and I'm writing enough like "query this value from this xml document" stuff that I want them