1
1
mirror of https://github.com/nmattia/niv.git synced 2024-12-24 04:08:54 +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 ViewPatterns #-}
module Niv where
module Main where
import Control.Applicative
import Control.Monad
@ -18,7 +18,6 @@ import Data.Hashable (Hashable)
import Data.Maybe (fromMaybe)
import Data.String.QQ (s)
import Niv.GitHub
import Niv.Test
import Niv.Update
import System.Exit (exitFailure)
import System.FilePath ((</>), takeDirectory)
@ -36,7 +35,6 @@ import qualified GitHub as GH
import qualified Options.Applicative as Opts
import qualified Options.Applicative.Help.Pretty as Opts
import qualified System.Directory as Dir
import qualified Test.Tasty as Tasty
main :: IO ()
main = join $ Opts.execParser opts
@ -153,13 +151,6 @@ parsePackageSpec =
parsePackage :: Opts.Parser (PackageName, PackageSpec)
parsePackage = (,) <$> parsePackageName <*> parsePackageSpec
-------------------------------------------------------------------------------
-- PACKAGE SPEC OPS
-------------------------------------------------------------------------------
test :: IO ()
test = Tasty.defaultMain $ Niv.Test.tests
-------------------------------------------------------------------------------
-- 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; };
niv-test = pkgs.runCommand "niv-test" { buildInputs = [ niv ] ; }
"niv-test && touch $out";
readme = pkgs.writeText "README.md"
(with
{ template = builtins.readFile ./README.tpl.md;

View File

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