diff --git a/feedback-test-harness/.gitignore b/feedback-test-harness/.gitignore new file mode 100644 index 0000000..c368d45 --- /dev/null +++ b/feedback-test-harness/.gitignore @@ -0,0 +1,2 @@ +.stack-work/ +*~ \ No newline at end of file diff --git a/feedback-test-harness/default.nix b/feedback-test-harness/default.nix new file mode 100644 index 0000000..4339946 --- /dev/null +++ b/feedback-test-harness/default.nix @@ -0,0 +1,15 @@ +{ mkDerivation, base, feedback, lib, path, path-io, sydtest +, sydtest-discover, typed-process +}: +mkDerivation { + pname = "feedback-test-harness"; + version = "0.0.0.0"; + src = ./.; + libraryHaskellDepends = [ base feedback path path-io ]; + testHaskellDepends = [ base feedback sydtest typed-process ]; + testToolDepends = [ sydtest-discover ]; + doHaddock = false; + homepage = "https://github.com/NorfairKing/feedback#readme"; + description = "Tests for 'feedback'"; + license = lib.licenses.gpl3Only; +} diff --git a/feedback-test-harness/feedback-test-harness.cabal b/feedback-test-harness/feedback-test-harness.cabal new file mode 100644 index 0000000..d181121 --- /dev/null +++ b/feedback-test-harness/feedback-test-harness.cabal @@ -0,0 +1,55 @@ +cabal-version: 2.2 + +-- This file has been generated from package.yaml by hpack version 0.34.7. +-- +-- see: https://github.com/sol/hpack + +name: feedback-test-harness +version: 0.0.0.0 +synopsis: Tests for 'feedback' +homepage: https://github.com/NorfairKing/feedback#readme +bug-reports: https://github.com/NorfairKing/feedback/issues +author: Tom Sydney Kerckhove +maintainer: syd@cs-syd.eu +copyright: Copyright (c) 2022-2023 Tom Sydney Kerckhove +license: GPL-3.0-only +build-type: Simple + +source-repository head + type: git + location: https://github.com/NorfairKing/feedback + +library + other-modules: + Paths_feedback_test_harness + autogen-modules: + Paths_feedback_test_harness + hs-source-dirs: + src + build-depends: + base >=4.7 && <5 + , feedback + , path + , path-io + default-language: Haskell2010 + +test-suite feedback-test + type: exitcode-stdio-1.0 + main-is: Spec.hs + other-modules: + FeedbackSpec + Paths_feedback_test_harness + autogen-modules: + Paths_feedback_test_harness + hs-source-dirs: + test/ + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall + build-tool-depends: + sydtest-discover:sydtest-discover + build-depends: + base >=4.7 && <5 + , feedback + , feedback-test-harness + , sydtest + , typed-process + default-language: Haskell2010 diff --git a/feedback-test-harness/package.yaml b/feedback-test-harness/package.yaml new file mode 100644 index 0000000..9851ed0 --- /dev/null +++ b/feedback-test-harness/package.yaml @@ -0,0 +1,34 @@ +name: feedback-test-harness +version: 0.0.0.0 +github: "NorfairKing/feedback" +license: GPL-3.0-only +author: "Tom Sydney Kerckhove" +maintainer: "syd@cs-syd.eu" +copyright: "Copyright (c) 2022-2023 Tom Sydney Kerckhove" +synopsis: Tests for 'feedback' + +dependencies: +- base >= 4.7 && < 5 + +library: + source-dirs: src + dependencies: + - feedback + - path + - path-io + +tests: + feedback-test: + main: Spec.hs + source-dirs: test/ + build-tools: sydtest-discover + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -Wall + dependencies: + - feedback + - feedback-test-harness + - sydtest + - typed-process diff --git a/feedback-test-harness/test/FeedbackSpec.hs b/feedback-test-harness/test/FeedbackSpec.hs new file mode 100644 index 0000000..30f1660 --- /dev/null +++ b/feedback-test-harness/test/FeedbackSpec.hs @@ -0,0 +1,11 @@ +module FeedbackSpec (spec) where + +import System.Process.Typed +import Test.Syd + +spec :: Spec +spec = sequential $ do + it "can show help text" $ do + let cp = setStdout nullStream $ proc "feedback" ["--help"] + runProcess_ cp :: IO () + pure () diff --git a/feedback-test-harness/test/Spec.hs b/feedback-test-harness/test/Spec.hs new file mode 100644 index 0000000..ebed7e1 --- /dev/null +++ b/feedback-test-harness/test/Spec.hs @@ -0,0 +1 @@ +{-# OPTIONS_GHC -F -pgmF sydtest-discover #-} diff --git a/flake.nix b/flake.nix index 00c99c5..b63c254 100644 --- a/flake.nix +++ b/flake.nix @@ -63,7 +63,7 @@ }; devShells.${system}.default = pkgs.haskellPackages.shellFor { name = "feedback-shell"; - packages = p: [ p.feedback ]; + packages = p: [ p.feedback p.feedback-test-harness ]; withHoogle = true; doBenchmark = true; buildInputs = (with pkgs; [ diff --git a/nix/overlay.nix b/nix/overlay.nix index d13b360..32bba98 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -15,6 +15,7 @@ with final.haskell.lib; overrides = composeExtensions (old.overrides or (_: _: { })) ( self: super: { + feedback-test-harness = addBuildDepend (self.callPackage ../feedback-test-harness { }) final.feedback; feedback = generateOptparseApplicativeCompletion "feedback" ( buildFromSdist (overrideCabal (