tasty-silver 3.1.8.1 → 3.1.9
raw patch · 4 files changed
+38/−10 lines, 4 filesdep ~optparse-applicativePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: optparse-applicative
API changes (from Hackage documentation)
Files
- CHANGELOG.md +16/−0
- Test/Tasty/Silver/Interactive.hs +18/−8
- Test/Tasty/Silver/Internal.hs +1/−0
- tasty-silver.cabal +3/−2
CHANGELOG.md view
@@ -1,6 +1,22 @@ Changes ======= +Version 3.1.9+-------------++* Fix compilation with optparse-applicative 0.13.*.+* Provide character-level diff if wdiff and colordiff are available.++Version 3.1.8.1+---------------++* Fix compilation with GHC 8.++Version 3.1.8+-------------++* Make update function optional for test cases.+ Version 3.1.7 -------------
Test/Tasty/Silver/Interactive.hs view
@@ -56,6 +56,7 @@ import System.Process.ByteString as PS import System.Process import qualified Data.ByteString as BS+import System.Directory import System.IO import System.IO.Temp import System.FilePath@@ -179,27 +180,36 @@ printDiff :: TestName -> GDiff -> IO ()-printDiff n (DiffText _ tGold tAct) = withDiffEnv+printDiff n (DiffText _ tGold tAct) = withDiffEnv n tGold tAct (\fGold fAct -> do (_, stdOut, _) <- PTL.readProcessWithExitCode "sh" ["-c", "git diff --no-index --text " ++ fGold ++ " " ++ fAct] T.empty TIO.putStrLn stdOut )- n tGold tAct printDiff _ (ShowDiffed _ t) = TIO.putStrLn t printDiff _ Equal = error "Can't print diff for equal values." showDiff :: TestName -> GDiff -> IO ()-showDiff n (DiffText _ tGold tAct) = withDiffEnv- (\fGold fAct -> callProcess "sh"- ["-c", "git diff --color=always --no-index --text " ++ fGold ++ " " ++ fAct ++ " | less -r > /dev/tty"])- n tGold tAct+showDiff n (DiffText _ tGold tAct) = do+ hasColorDiff' <- hasColorDiff++ withDiffEnv n tGold tAct+ (if hasColorDiff' then colorDiff else gitDiff)+ where+ gitDiff fGold fAct = callProcess "sh"+ ["-c", "git diff --color=always --no-index --text " ++ fGold ++ " " ++ fAct ++ " | less -r > /dev/tty"]++ doesCmdExist cmd = isJust <$> findExecutable cmd++ hasColorDiff = (&&) <$> doesCmdExist "wdiff" <*> doesCmdExist "colordiff"++ colorDiff fGold fAct = callProcess "sh" ["-c", "wdiff " ++ fGold ++ " " ++ fAct ++ " | colordiff | less -r > /dev/tty"] showDiff n (ShowDiffed _ t) = showInLess n t showDiff _ Equal = error "Can't show diff for equal values." -- Stores the golden/actual text in two files, so we can use it for git diff.-withDiffEnv :: (FilePath -> FilePath -> IO ()) -> TestName -> T.Text -> T.Text -> IO ()-withDiffEnv cont n tGold tAct = do+withDiffEnv :: TestName -> T.Text -> T.Text -> (FilePath -> FilePath -> IO ()) -> IO ()+withDiffEnv n tGold tAct cont = do withSystemTempFile (n <.> "golden") (\fGold hGold -> do withSystemTempFile (n <.> "actual") (\fAct hAct -> do hSetBinaryMode hGold True
Test/Tasty/Silver/Internal.hs view
@@ -13,6 +13,7 @@ import System.IO.Error import qualified Data.Text as T import Options.Applicative+import Data.Monoid import Data.Tagged import Data.Proxy import Data.Maybe
tasty-silver.cabal view
@@ -1,5 +1,5 @@ name: tasty-silver-version: 3.1.8.1+version: 3.1.9 synopsis: A fancy test runner, including support for golden tests. description: This package provides a fancy test runner and support for «golden testing».@@ -17,13 +17,14 @@ license-file: LICENSE Homepage: https://github.com/phile314/tasty-silver Bug-reports: https://github.com/phile314/tasty-silver/issues-author: Roman Cheplyaka, Philipp Hausmann and others+author: Philipp Hausmann, Roman Cheplyaka and others maintainer: Philipp Hausmann -- copyright: category: Testing build-type: Simple cabal-version: >=1.14 extra-source-files: CHANGELOG.md+tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1 Source-repository head type: git