From 8f76ec738e9e43a2cc3432616d1a2c9fea756d03 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 24 Aug 2023 00:00:31 +0200 Subject: [PATCH] flake: Attempt to run doctests Reviewed-by: Alexander Kobjolke --- flake.nix | 9 ++++----- hcat.cabal | 6 +----- package.yaml | 15 +++++++++++---- test/doctest/Doctest.hs | 10 ++++++++++ test/{ => spec}/HCatSpec.hs | 0 test/{ => spec}/Spec.hs | 0 6 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 test/doctest/Doctest.hs rename test/{ => spec}/HCatSpec.hs (100%) rename test/{ => spec}/Spec.hs (100%) diff --git a/flake.nix b/flake.nix index 5a98b08..4eb0f19 100644 --- a/flake.nix +++ b/flake.nix @@ -22,10 +22,8 @@ packageName = "hcat"; in { - packages.${packageName} = haskellPackages.callCabal2nix packageName self - rec { - # Dependency overrides go here - }; + packages.${packageName} = + haskellPackages.callCabal2nix packageName self { }; packages.default = self.packages.${system}.${packageName}; @@ -64,7 +62,8 @@ devShells.default = haskellPackages.shellFor { inherit (self.checks.${system}.pre-commit-check) shellHook; - packages = p: [ self.packages.${system}.default ]; + packages = _: + pkgs.lib.filter (x: x != null) [ self.packages.${system}.default ]; withHoogle = true; diff --git a/hcat.cabal b/hcat.cabal index fecf793..3857735 100644 --- a/hcat.cabal +++ b/hcat.cabal @@ -47,7 +47,6 @@ executable hcat build-depends: base >=4.13 && <5 , hcat - , text default-language: GHC2021 test-suite spec @@ -57,7 +56,7 @@ test-suite spec HCatSpec Paths_hcat hs-source-dirs: - test + test/spec default-extensions: BlockArguments OverloadedStrings @@ -71,7 +70,4 @@ test-suite spec , base >=4.13 && <5 , hcat , hspec - , quickcheck-instances - , quickcheck-text - , text default-language: GHC2021 diff --git a/package.yaml b/package.yaml index 4ddf9af..e364b22 100644 --- a/package.yaml +++ b/package.yaml @@ -11,7 +11,6 @@ extra-source-files: dependencies: - base >= 4.13 && < 5 - - text # - bytestring # - time # - process @@ -29,6 +28,8 @@ default-extensions: library: source-dirs: src + dependencies: + - text verbatim: default-language: GHC2021 @@ -46,13 +47,19 @@ tests: cpp-options: -DTEST main: Spec.hs source-dirs: - - test + - test/spec dependencies: - hcat - hspec - QuickCheck - - quickcheck-instances - - quickcheck-text + # - quickcheck-instances + # - quickcheck-text build-tools: hspec-discover verbatim: default-language: GHC2021 + # doctest: + # main: Doctest.hs + # source-dirs: + # - test/doctest + # dependencies: + # - process diff --git a/test/doctest/Doctest.hs b/test/doctest/Doctest.hs new file mode 100644 index 0000000..72c84cf --- /dev/null +++ b/test/doctest/Doctest.hs @@ -0,0 +1,10 @@ +-- | Rn the doctest executable +module Main where + +import System.Process (callProcess) + +doctest :: [String] -> IO () +doctest = callProcess "doctest" + +main :: IO () +main = doctest ["--fast", "src"] diff --git a/test/HCatSpec.hs b/test/spec/HCatSpec.hs similarity index 100% rename from test/HCatSpec.hs rename to test/spec/HCatSpec.hs diff --git a/test/Spec.hs b/test/spec/Spec.hs similarity index 100% rename from test/Spec.hs rename to test/spec/Spec.hs