working project structure with tests

- restructured project again: splitting into executable and Hash2Pub
  library
- placeholder test file is successfully compiled and run
This commit is contained in:
Trolli Schmittlauch 2020-03-04 17:24:03 +01:00
parent 30cfed81ea
commit 21fef145a0
10 changed files with 27 additions and 25 deletions

View file

@ -45,32 +45,29 @@ category: Network
-- README. -- README.
extra-source-files: CHANGELOG.md extra-source-files: CHANGELOG.md
--library
-- -- Modules exported by the library.
-- exposed-modules: FediChord, Main
--
-- -- Modules included in this library but not exported.
-- -- other-modules:
--
-- -- LANGUAGE extensions used by modules in this package.
-- other-extensions: GeneralizedNewtypeDeriving
--
-- -- Other library packages from which modules are imported.
-- build-depends: base ^>=4.12.0.0, containers ^>=0.6.0.1, utf8-string ^>=1.0.1.1, network ^>=2.8.0.1, time ^>=1.8.0.2
--
-- -- Directories containing source files.
-- -- hs-source-dirs:
--
-- -- Base language which the package is written in.
-- default-language: Haskell2010
common deps common deps
build-depends: base ^>=4.12.0.0, containers ^>=0.6.0.1, utf8-string ^>=1.0.1.1, network ^>=2.8.0.1, time ^>=1.8.0.2, cmdargs ^>= 0.10, cryptonite ^>= 0.25 build-depends: base ^>=4.12.0.0, containers ^>=0.6.0.1, utf8-string ^>=1.0.1.1, network ^>=2.8.0.1, time ^>=1.8.0.2, cmdargs ^>= 0.10, cryptonite ^>= 0.25
ghc-options: -Wall ghc-options: -Wall
common test-deps
build-depends: hspec ^>= 2
library
import: deps
-- Modules exported by the library.
exposed-modules: Hash2Pub.FediChord
-- Modules included in this library but not exported.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
other-extensions: GeneralizedNewtypeDeriving
-- Directories containing source files.
hs-source-dirs: src
-- Base language which the package is written in.
default-language: Haskell2010
executable Hash2Pub executable Hash2Pub
-- Other library packages from which modules are imported. -- Other library packages from which modules are imported.
@ -86,7 +83,7 @@ executable Hash2Pub
other-extensions: GeneralizedNewtypeDeriving other-extensions: GeneralizedNewtypeDeriving
-- Directories containing source files. -- Directories containing source files.
-- hs-source-dirs: -- hs-source-dirs: .
-- Base language which the package is written in. -- Base language which the package is written in.
default-language: Haskell2010 default-language: Haskell2010
@ -94,7 +91,7 @@ executable Hash2Pub
test-suite Hash2Pub-test test-suite Hash2Pub-test
-- Test dependencies. -- Test dependencies.
import: deps, test-deps import: deps
-- Base language which the package is written in. -- Base language which the package is written in.
default-language: Haskell2010 default-language: Haskell2010
@ -107,4 +104,5 @@ test-suite Hash2Pub-test
-- The entrypoint to the test suite. -- The entrypoint to the test suite.
main-is: MyLibTest.hs main-is: MyLibTest.hs
build-depends: hspec, Hash2Pub

View file

@ -1,4 +1,6 @@
module Main where module Main where
import FediChord
main :: IO () main :: IO ()
main = putStrLn "placeholder until later" main = putStrLn "placeholder until later"

View file

@ -2,7 +2,7 @@
let let
inherit (pkgs) haskellPackages; inherit (pkgs) haskellPackages;
drv = haskellPackages.callCabal2nix "Hash2Pub" ./Hash2Pub {}; drv = haskellPackages.callCabal2nix "Hash2Pub" ./. {};
in in
{ {
my_project = drv; my_project = drv;

View file

@ -1,4 +1,6 @@
module Main (main) where module Main (main) where
import qualified Hash2Pub.FediChord as FC
main :: IO () main :: IO ()
main = putStrLn "Test suite not yet implemented." main = putStrLn "Test suite not yet implemented."