Split the code into library and application

This commit is contained in:
Eugen Wissner 2023-09-22 07:33:02 +02:00
parent a7114618c1
commit 840290491f
5 changed files with 41 additions and 26 deletions

View File

@ -19,18 +19,11 @@ common dependencies
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
build-depends: build-depends:
base ^>= 4.16.4.0, base ^>= 4.16.4.0,
cryptonite >= 0.30,
executable slackbuilder filepath ^>= 1.4.2,
import: dependencies modern-uri ^>= 0.3.6,
main-is: Main.hs text ^>= 2.0
default-language: Haskell2010
other-modules:
SlackBuilder.CommandLine
SlackBuilder.Config
SlackBuilder.Download
SlackBuilder.Package
SlackBuilder.Trans
SlackBuilder.Updater
default-extensions: default-extensions:
DataKinds DataKinds
DuplicateRecordFields DuplicateRecordFields
@ -41,25 +34,38 @@ executable slackbuilder
QuasiQuotes QuasiQuotes
TemplateHaskell TemplateHaskell
TypeApplications TypeApplications
library slackbuilder-internal
import: dependencies
exposed-modules:
SlackBuilder.Config
SlackBuilder.Package
SlackBuilder.Trans
hs-source-dirs: lib
build-depends:
exceptions >= 0.10,
tomland ^>= 1.3.3,
transformers ^>= 0.5.6
executable slackbuilder
import: dependencies
main-is: Main.hs
other-modules:
SlackBuilder.CommandLine
SlackBuilder.Download
SlackBuilder.Updater
build-depends: build-depends:
aeson ^>= 2.2.0, aeson ^>= 2.2.0,
bytestring ^>= 0.11.0, bytestring ^>= 0.11.0,
conduit ^>= 1.3.5, conduit ^>= 1.3.5,
cryptonite >= 0.30,
exceptions >= 0.10,
filepath ^>= 1.4.2,
http-client ^>= 0.7, http-client ^>= 0.7,
modern-uri ^>= 0.3.6,
optparse-applicative ^>= 0.18.1, optparse-applicative ^>= 0.18.1,
process ^>= 1.6.17, process ^>= 1.6.17,
req ^>= 3.13, req ^>= 3.13,
text ^>= 2.0,
tomland ^>= 1.3.3,
transformers ^>= 0.5.6,
unordered-containers ^>= 0.2.19, unordered-containers ^>= 0.2.19,
vector ^>= 0.13.0 vector ^>= 0.13.0
hs-source-dirs: app hs-source-dirs: app
default-language: Haskell2010
test-suite slackbuilder-test test-suite slackbuilder-test
import: dependencies import: dependencies
@ -68,8 +74,7 @@ test-suite slackbuilder-test
other-modules: other-modules:
SlackBuilder.PackageSpec SlackBuilder.PackageSpec
hs-source-dirs: hs-source-dirs: tests
tests
default-language: Haskell2010
build-depends: build-depends:
hspec >= 2.10.9 && < 2.12 hspec >= 2.10.9 && < 2.12,
slackbuilder-internal

View File

@ -2,7 +2,17 @@ module SlackBuilder.PackageSpec
( spec ( spec
) where ) where
import Test.Hspec (Spec) import SlackBuilder.Package
import Test.Hspec (Spec, describe, it, shouldBe)
import Text.URI.QQ (uri)
spec :: Spec spec :: Spec
spec = pure () spec = do
describe "renderDownloadWithVersion" $
it "renders text as URL" $
let given = DownloadTemplate
$ pure
$ StaticPlaceholder "https://example.com"
actual = renderDownloadWithVersion given "1.2"
expected = Just [uri|https://example.com|]
in actual `shouldBe` expected