From df6efcff60b00d6d474e8237b2fe86c6d9bdb24b Mon Sep 17 00:00:00 2001 From: EvanPiro <37887152+EvanPiro@users.noreply.github.com> Date: Mon, 8 Aug 2022 11:02:43 -0400 Subject: [PATCH] `bin/test`: run test, and reload on library change (#32) * test script now runs on test file update * added src to cabal tests to get auto reload * fixed formatting * removed unneeded test dependency * fixed cabal formatting issue * Remove library stanza; no longer needed * hs-source-dirs belongs to shared Because we are sharing 'src' * Fix compilation * Move other-modules as well. Co-authored-by: Sridhar Ratnakumar --- bin/test | 2 +- haskell-template.cabal | 16 +++++----------- tests/{Main.hs => Spec.hs} | 0 3 files changed, 6 insertions(+), 12 deletions(-) rename tests/{Main.hs => Spec.hs} (100%) diff --git a/bin/test b/bin/test index 1af41c2..7d742d6 100755 --- a/bin/test +++ b/bin/test @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -xe -exec nix develop -c ghcid -c "cabal repl test:tests" +exec nix develop -c ghcid -c "cabal repl test:tests" -T :main diff --git a/haskell-template.cabal b/haskell-template.cabal index cf46712..5d398ba 100644 --- a/haskell-template.cabal +++ b/haskell-template.cabal @@ -91,23 +91,17 @@ common shared , time , with-utf8 + hs-source-dirs: src + other-modules: Lib + executable haskell-template import: shared main-is: Main.hs - hs-source-dirs: src default-language: Haskell2010 - other-modules: Lib - -library - import: shared - exposed-modules: Lib - hs-source-dirs: src test-suite tests import: shared - main-is: Main.hs + main-is: Spec.hs type: exitcode-stdio-1.0 hs-source-dirs: tests - build-depends: - , haskell-template - , hspec + build-depends: hspec diff --git a/tests/Main.hs b/tests/Spec.hs similarity index 100% rename from tests/Main.hs rename to tests/Spec.hs