Skip to content

Commit

Permalink
Reorganize to allow for Haskell tests (#35)
Browse files Browse the repository at this point in the history
This builds goldplate as a library first.  This allows us to write Haskell
tests where we import this library in addition to the golden tests we have
already.
  • Loading branch information
jaspervdj authored Aug 4, 2023
1 parent 318cecd commit 1091877
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 deletions.
6 changes: 6 additions & 0 deletions Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Main (main) where

import qualified Goldplate

main :: IO ()
main = Goldplate.main
42 changes: 24 additions & 18 deletions goldplate.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,44 @@ Source-repository this
location: https://github.com/fugue/goldplate.git
tag: v0.2.1.1

Executable goldplate
Library
Hs-source-dirs: src
Main-is: Main.hs
Default-language: Haskell2010
Ghc-options: -Wall -rtsopts -threaded
Ghc-options: -Wall
Exposed-modules: Goldplate

Other-modules:
Text.Regex.PCRE.Simple
Text.Splice
Paths_goldplate

Build-depends:
aeson >= 1.4 && < 2.3,
aeson-pretty >= 0.8 && < 0.9,
async >= 2.2 && < 2.3,
base >= 4.11 && < 5,
bytestring >= 0.10 && < 0.13,
Diff >= 0.3 && < 0.5,
directory >= 1.3 && < 1.4,
filepath >= 1.4 && < 1.5,
Glob >= 0.10 && < 0.11,
optparse-applicative >= 0.14 && < 0.19,
process >= 1.6 && < 1.7,
aeson >= 1.4 && < 2.3,
aeson-pretty >= 0.8 && < 0.9,
async >= 2.2 && < 2.3,
base >= 4.11 && < 5,
bytestring >= 0.10 && < 0.13,
Diff >= 0.3 && < 0.5,
directory >= 1.3 && < 1.4,
filepath >= 1.4 && < 1.5,
Glob >= 0.10 && < 0.11,
optparse-applicative >= 0.14 && < 0.19,
process >= 1.6 && < 1.7,
regex-pcre-builtin >= 0.95.1.3 && < 0.96,
text >= 1.2 && < 2.1,
unordered-containers >= 0.2 && < 0.3
text >= 1.2 && < 2.1,
unordered-containers >= 0.2 && < 0.3

Executable goldplate
Main-is: Main.hs
Default-language: Haskell2010
Ghc-options: -Wall -rtsopts -threaded
Build-depends: base, goldplate

Test-suite tests
Default-language: Haskell2010
Type: exitcode-stdio-1.0
Ghc-options: -threaded
Ghc-options: -Wall -threaded
Main-is: Tests.hs
Build-depends: base, process
Build-tool-depends: goldplate:goldplate
Hs-source-dirs: tests
Build-depends: base, process
2 changes: 1 addition & 1 deletion src/Main.hs → src/Goldplate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main
module Goldplate
( main
) where

Expand Down
5 changes: 3 additions & 2 deletions tests/Tests.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import System.Exit ( exitWith )
import System.Process ( system )
module Main (main) where
import System.Exit (exitWith)
import System.Process (system)

main :: IO ()
main = exitWith =<< system ("goldplate tests")

0 comments on commit 1091877

Please sign in to comment.