Hello community,

here is the log from the commit of package ghc-tasty-silver for 
openSUSE:Factory checked in at 2017-04-14 13:41:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-tasty-silver (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-tasty-silver.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-tasty-silver"

Fri Apr 14 13:41:31 2017 rev:3 rq:487389 version:3.1.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-tasty-silver/ghc-tasty-silver.changes        
2017-03-08 01:12:43.249324514 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-tasty-silver.new/ghc-tasty-silver.changes   
2017-04-14 13:41:32.882938975 +0200
@@ -1,0 +2,5 @@
+Tue Apr  4 11:02:14 UTC 2017 - [email protected]
+
+- Update to version 3.1.10 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  tasty-silver-3.1.9.tar.gz

New:
----
  tasty-silver-3.1.10.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-tasty-silver.spec ++++++
--- /var/tmp/diff_new_pack.RilUBF/_old  2017-04-14 13:41:33.722820271 +0200
+++ /var/tmp/diff_new_pack.RilUBF/_new  2017-04-14 13:41:33.722820271 +0200
@@ -19,7 +19,7 @@
 %global pkg_name tasty-silver
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        3.1.9
+Version:        3.1.10
 Release:        0
 Summary:        A fancy test runner, including support for golden tests
 License:        MIT

++++++ tasty-silver-3.1.9.tar.gz -> tasty-silver-3.1.10.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tasty-silver-3.1.9/CHANGELOG.md 
new/tasty-silver-3.1.10/CHANGELOG.md
--- old/tasty-silver-3.1.9/CHANGELOG.md 2016-08-29 21:47:54.000000000 +0200
+++ new/tasty-silver-3.1.10/CHANGELOG.md        2017-04-01 19:24:02.000000000 
+0200
@@ -1,6 +1,11 @@
 Changes
 =======
 
+Version 3.1.10
+--------------
+
+* Better error handling for calls to external tools (`git diff`)
+
 Version 3.1.9
 -------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tasty-silver-3.1.9/Test/Tasty/Silver/Interactive.hs 
new/tasty-silver-3.1.10/Test/Tasty/Silver/Interactive.hs
--- old/tasty-silver-3.1.9/Test/Tasty/Silver/Interactive.hs     2016-08-29 
21:47:54.000000000 +0200
+++ new/tasty-silver-3.1.10/Test/Tasty/Silver/Interactive.hs    2017-04-01 
19:21:17.000000000 +0200
@@ -57,6 +57,7 @@
 import System.Process
 import qualified Data.ByteString as BS
 import System.Directory
+import System.Exit
 import System.IO
 import System.IO.Temp
 import System.FilePath
@@ -180,12 +181,22 @@
 
 
 printDiff :: TestName -> GDiff -> IO ()
-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
-
-  )
+printDiff n (DiffText _ tGold tAct) = do
+  hasGit <- doesCmdExist "git"
+  if hasGit then
+    withDiffEnv n tGold tAct
+      (\fGold fAct -> do
+        ret <- PTL.readProcessWithExitCode "sh" ["-c", "git diff --no-index 
--text " ++ fGold ++ " " ++ fAct] T.empty
+        case ret of
+          (ExitSuccess, stdOut, _) -> TIO.putStrLn stdOut
+          _ -> error ("Call to `git diff` failed: " ++ show ret)
+      )
+  else do
+    putStrLn "`git diff` not available, cannot produce a diff."
+    putStrLn "Golden value:"
+    TIO.putStrLn tGold
+    putStrLn "Actual value:"
+    TIO.putStrLn tAct
 printDiff _ (ShowDiffed _ t) = TIO.putStrLn t
 printDiff _ Equal = error "Can't print diff for equal values."
 
@@ -199,14 +210,15 @@
     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."
 
+doesCmdExist :: String -> IO Bool
+doesCmdExist cmd = isJust <$> findExecutable cmd
+
 -- Stores the golden/actual text in two files, so we can use it for git diff.
 withDiffEnv :: TestName -> T.Text -> T.Text -> (FilePath -> FilePath -> IO ()) 
-> IO ()
 withDiffEnv n tGold tAct cont = do
@@ -231,9 +243,15 @@
 
 showInLess :: String -> T.Text -> IO ()
 showInLess _ t = do
-  -- TODO error handling...
-  _ <- PS.readProcessWithExitCode "sh" ["-c", "less > /dev/tty"] inp
-  return ()
+  isTerm <- hSupportsANSI stdout
+  if isTerm
+    then do
+      ret <- PS.readProcessWithExitCode "sh" ["-c", "less > /dev/tty"] inp
+      case ret of
+        ret@(ExitFailure _, _, _) -> error $ show ret
+        _ -> return ()
+    else
+      TIO.putStrLn t
   where inp = encodeUtf8 t
 
 tryAccept :: String -> TestName -> (a -> IO ()) -> a -> IO Bool
@@ -339,7 +357,7 @@
           (result', stat') <- case (resultOutcome result) of
             Failure (TestThrewException e) ->
               case fromException e of
-                Just (Mismatch (GRDifferent _ a diff Nothing)) -> do
+                Just (Mismatch (GRDifferent _ _ _ Nothing)) -> do
                   printResultLine result False
                   s <- printTestOutput pref name result
                   return (testFailed "", s)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tasty-silver-3.1.9/tasty-silver.cabal 
new/tasty-silver-3.1.10/tasty-silver.cabal
--- old/tasty-silver-3.1.9/tasty-silver.cabal   2016-08-29 21:47:54.000000000 
+0200
+++ new/tasty-silver-3.1.10/tasty-silver.cabal  2017-04-01 19:24:02.000000000 
+0200
@@ -1,5 +1,5 @@
 name:                tasty-silver
-version:             3.1.9
+version:             3.1.10
 synopsis:            A fancy test runner, including support for golden tests.
 description:
   This package provides a fancy test runner and support for «golden testing».


Reply via email to