goldplate 0.2.0 → 0.2.1.1
raw patch · 5 files changed
+58/−16 lines, 5 filesdep ~Diffdep ~aesondep ~basenew-uploader
Dependency ranges changed: Diff, aeson, base, bytestring, filepath, optparse-applicative, process, text
Files
- CHANGELOG.md +10/−0
- README.md +4/−1
- goldplate.cabal +20/−8
- src/Main.hs +19/−7
- tests/Tests.hs +5/−0
CHANGELOG.md view
@@ -1,5 +1,15 @@ # CHANGELOG + - 0.2.1.1 (2023-02-26)+ * Bump `aeson` dependency upper bound to 2.1.+ * Tested with GHC 8.4 - 9.6.1 alpha3.++ - 0.2.1 (2022-04-12, github release only)+ * Print summary line at the end of the TAP format.+ * Add `--version` option (by Andreas Abel).+ * Include testsuite in package (by Andreas Abel).+ * Tested with GHC 8.4 - 9.2.+ - 0.2.0 (2021-05-24) * Change output to [Test Anything Protocol](https://testanything.org/). * Add `working_directory` field (by Beatrice Vergani).
README.md view
@@ -212,7 +212,10 @@ ## Installation -Installation through source is done using standard Haskell tooling -- [Cabal]+Binaries for Mac OS and Linux are available on the+[releases page](https://github.com/fugue/goldplate/releases).++Installation from source is done using standard Haskell tooling -- [Cabal] and [stack] both work well. ### Using stack
goldplate.cabal view
@@ -1,10 +1,10 @@ Name: goldplate-Version: 0.2.0+Version: 0.2.1.1 Synopsis: A lightweight golden test runner License: Apache-2.0 License-file: LICENSE Author: Jasper Van der Jeugt <jasper@fugue.co>-Maintainer: Jasper Van der Jeugt <jasper@fugue.co>+Maintainer: Jasper Van der Jeugt <jasper@fugue.co>, Andreas Abel Copyright: 2019-2021 Fugue, Inc Homepage: https://github.com/fugue/goldplate Bug-reports: https://github.com/fugue/goldplate/issues@@ -14,8 +14,11 @@ Description: Language-agnostic golden test runner for command-line applications. Tested-with:- GHC == 9.0.1- GHC == 8.10.4+ GHC == 9.6.0+ GHC == 9.4.4+ GHC == 9.2.6+ GHC == 9.0.2+ GHC == 8.10.7 GHC == 8.8.4 GHC == 8.6.5 GHC == 8.4.4@@ -31,7 +34,7 @@ Source-repository this type: git location: git://github.com/fugue/goldplate.git- tag: v0.2.0+ tag: v0.2.1.1 Executable goldplate Hs-source-dirs: src@@ -45,7 +48,7 @@ Paths_goldplate Build-depends:- aeson >= 1.4 && < 1.6,+ aeson >= 1.4 && < 2.2, aeson-pretty >= 0.8 && < 0.9, async >= 2.2 && < 2.3, base >= 4.11 && < 5,@@ -54,8 +57,17 @@ directory >= 1.3 && < 1.4, filepath >= 1.4 && < 1.5, Glob >= 0.10 && < 0.11,- optparse-applicative >= 0.14 && < 0.17,+ optparse-applicative >= 0.14 && < 0.18, process >= 1.6 && < 1.7, regex-pcre-builtin >= 0.95.1.3 && < 0.96,- text >= 1.2 && < 1.3,+ text >= 1.2 && < 2.1, unordered-containers >= 0.2 && < 0.3++Test-suite tests+ Default-language: Haskell2010+ Type: exitcode-stdio-1.0+ Ghc-options: -threaded+ Main-is: Tests.hs+ Build-depends: base, process+ Build-tool-depends: goldplate:goldplate+ Hs-source-dirs: tests
src/Main.hs view
@@ -200,7 +200,7 @@ mkAbsoluteWorkDir dir | FP.isRelative dir = specDirectory FP.</> dir | otherwise = dir - workDirectory = maybe specDirectory mkAbsoluteWorkDir (specWorkDir spec) + workDirectory = maybe specDirectory mkAbsoluteWorkDir (specWorkDir spec) -- Compute initial environment to get input files. env0 <- getEnvironment@@ -480,9 +480,17 @@ OA.help "Number of worker jobs") parserInfo :: OA.ParserInfo Options-parserInfo = OA.info (OA.helper <*> parseOptions) $+parserInfo = OA.info (OA.helper <*> versionOption <*> parseOptions) $ OA.fullDesc <>- OA.header ("goldplate v" <> showVersion version)+ OA.header goldplateVersion+ where+ versionOption = OA.infoOption goldplateVersion $+ OA.long "version" <>+ OA.short 'V' <>+ OA.help "Show version info" <>+ OA.hidden+ goldplateVersion :: String+ goldplateVersion = "goldplate v" <> showVersion version -------------------------------------------------------------------------------- @@ -504,7 +512,7 @@ main :: IO () main = do options <- OA.execParser parserInfo- failed <- IORef.newIORef False+ failed <- IORef.newIORef (0 :: Int) env <- Env <$> makeLogger (oVerbose options) <*> pure (oDiff options)@@ -542,9 +550,13 @@ executionResult <- runExecution env execution forM_ (specAsserts $ executionSpec execution) $ \assert -> do assertResult <- runAssert env execution executionResult assert- unless (arOk assertResult) $ IORef.writeIORef failed True+ unless (arOk assertResult) $ IORef.atomicModifyIORef' failed $+ \x -> (x + 1, ()) logOut (envLogger env) $ assertResultToTap assertResult -- Report summary.- hasFailed <- IORef.readIORef failed- when hasFailed exitFailure+ numFailed <- IORef.readIORef failed+ logOut (envLogger env) . pure $+ "# goldplate ran " ++ show numAsserts ++ " asserts, " +++ (if numFailed > 0 then show numFailed ++ " failed" else "all OK")+ when (numFailed > 0) exitFailure
+ tests/Tests.hs view
@@ -0,0 +1,5 @@+import System.Exit ( exitWith )+import System.Process ( system )++main :: IO ()+main = exitWith =<< system ("goldplate tests")