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
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.
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.)
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
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
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 ...
withnix-shell --run "cabal ..."
. For example,nix-shell --run "cabal new-test"
is probably what you want to run tests.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.)I wrote a small tutorial on nix here: https://www.srid.ca/haskell-nix.html
example project using both nix and tests https://github.com/kowainik/relude
ok thanks!
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