1
1
mirror of https://github.com/nmattia/niv.git synced 2024-11-07 22:36:53 +03:00

Move tests to exe

This commit is contained in:
Nicolas Mattia 2019-06-12 14:57:21 +02:00
parent 558e917f9c
commit 64e80a0cac
4 changed files with 18 additions and 14 deletions

View File

@ -7,7 +7,7 @@
{-# LANGUAGE TupleSections #-} {-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ViewPatterns #-}
module Niv where module Main where
import Control.Applicative import Control.Applicative
import Control.Monad import Control.Monad
@ -18,7 +18,6 @@ import Data.Hashable (Hashable)
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import Data.String.QQ (s) import Data.String.QQ (s)
import Niv.GitHub import Niv.GitHub
import Niv.Test
import Niv.Update import Niv.Update
import System.Exit (exitFailure) import System.Exit (exitFailure)
import System.FilePath ((</>), takeDirectory) import System.FilePath ((</>), takeDirectory)
@ -36,7 +35,6 @@ import qualified GitHub as GH
import qualified Options.Applicative as Opts import qualified Options.Applicative as Opts
import qualified Options.Applicative.Help.Pretty as Opts import qualified Options.Applicative.Help.Pretty as Opts
import qualified System.Directory as Dir import qualified System.Directory as Dir
import qualified Test.Tasty as Tasty
main :: IO () main :: IO ()
main = join $ Opts.execParser opts main = join $ Opts.execParser opts
@ -153,13 +151,6 @@ parsePackageSpec =
parsePackage :: Opts.Parser (PackageName, PackageSpec) parsePackage :: Opts.Parser (PackageName, PackageSpec)
parsePackage = (,) <$> parsePackageName <*> parsePackageSpec parsePackage = (,) <$> parsePackageName <*> parsePackageSpec
-------------------------------------------------------------------------------
-- PACKAGE SPEC OPS
-------------------------------------------------------------------------------
test :: IO ()
test = Tasty.defaultMain $ Niv.Test.tests
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- INIT -- INIT
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

8
app/test.hs Normal file
View File

@ -0,0 +1,8 @@
module Main where
import Niv.Test
import qualified Test.Tasty as Tasty
main :: IO ()
main = Tasty.defaultMain $ Niv.Test.tests

View File

@ -50,6 +50,9 @@ rec
tests = pkgs.callPackage ./tests { inherit niv; }; tests = pkgs.callPackage ./tests { inherit niv; };
niv-test = pkgs.runCommand "niv-test" { buildInputs = [ niv ] ; }
"niv-test && touch $out";
readme = pkgs.writeText "README.md" readme = pkgs.writeText "README.md"
(with (with
{ template = builtins.readFile ./README.tpl.md; { template = builtins.readFile ./README.tpl.md;

View File

@ -27,9 +27,7 @@ library:
executables: executables:
niv: niv:
source-dirs: main: app/niv.hs
- app
main: Niv.main
data-files: data-files:
- nix/sources.nix - nix/sources.nix
dependencies: dependencies:
@ -45,5 +43,9 @@ executables:
- optparse-applicative - optparse-applicative
- process - process
- string-qq - string-qq
- tasty
- unordered-containers - unordered-containers
niv-test:
main: app/test.hs
dependencies:
- tasty
- niv