specup 0.1.0.1 → 0.2.0.0
raw patch · 4 files changed
+28/−8 lines, 4 filesdep +process
Dependencies added: process
Files
- CHANGELOG.md +4/−0
- app/Main.hs +9/−6
- specup.cabal +5/−1
- test/Spec.hs +10/−1
+ CHANGELOG.md view
@@ -0,0 +1,4 @@+# Changelog for Specup++## 0.2.0.0+- The application now correctly returns a non-zero return code on parsing errors
app/Main.hs view
@@ -1,15 +1,18 @@ module Main where import Prelude hiding (readFile)+ import Data.ByteString.Char8 (readFile)-import SpecUp (invokeTemplateOnSpec)-import Options.Applicative (Parser, execParser, info, helper, fullDesc, long, short, metavar, value, help, strOption, progDesc, (<**>), option, auto)-import qualified Data.Text.Lazy.IO as LazyText import qualified Data.Text.IO as TextIO+import qualified Data.Text.Lazy.IO as LazyText+import Options.Applicative (Parser, execParser, info, helper, fullDesc, long, short, metavar, value, help, strOption, progDesc, (<**>), option, auto)+import SpecUp (invokeTemplateOnSpec)+import System.Exit (exitFailure)+import System.IO (hPutStr, stderr) data Args = Args {- specFile :: String-, template :: String+ specFile :: !String+, template :: !String } argParser :: Parser Args@@ -36,7 +39,7 @@ run args = do spec <- readFile $ specFile args template <- TextIO.readFile $ template args- either Prelude.putStrLn+ either (\s -> hPutStr stderr s >> exitFailure) LazyText.putStrLn $ invokeTemplateOnSpec template spec
specup.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: specup-version: 0.1.0.1+version: 0.2.0.0 author: Daniel Rolls maintainer: daniel.rolls.27@googlemail.com@@ -11,6 +11,8 @@ license: GPL-2.0-only license-files: LICENSE category: Documentation+extra-doc-files:+ CHANGELOG.md source-repository head type: git@@ -54,5 +56,7 @@ build-depends: hspec >=2.9.7 && <2.12, hspec-core >=2.9.7 && <2.12,+ process >= 1.6.18 && < 1.7, specup >=0+ build-tool-depends: specup:specup
test/Spec.hs view
@@ -2,10 +2,19 @@ import Test.Hspec (describe, hspec, it, shouldBe, expectationFailure) import Data.Text (Text, unlines) import qualified Data.Text.Lazy as LazyText+import System.Process (createProcess, StdStream(..), proc, std_out, std_err) import SpecUp (invokeTemplateOnSpec) -main = hspec $ do+a = do (_,mOut, mErr, procHandle) <- createProcess $ (proc "ls" []) {std_out = CreatePipe, std_err = CreatePipe}+ print "output"+ print mOut+ print "error"+ print mErr+ return ()+++main = (a >>) $ hspec $ do it "should pass new" $ invokeTemplateOnSpec testTmpl sampleTestYaml