diff --git a/Tests.hs b/Tests.hs
--- a/Tests.hs
+++ b/Tests.hs
@@ -41,7 +41,7 @@
 import Distribution.Compiler (CompilerFlavor(GHC))
 import Distribution.Package (PackageName(PackageName))
 import Prelude hiding (log)
-import System.Exit (ExitCode(ExitSuccess))
+import System.Exit (exitWith, ExitCode(..))
 import System.FilePath ((</>))
 import System.Process (readProcessWithExitCode)
 import Test.HUnit
@@ -181,7 +181,7 @@
                               finalizeDebianization)
                           atoms
                  diff <- diffDebianizations (view debInfo (expect atoms)) (view debInfo deb)
-                 assertEqual label [] diff)
+                 assertEmptyDiff label diff)
     where
       expect atoms =
           execCabalM
@@ -234,7 +234,7 @@
               do atoms <- testAtoms
                  deb <- (execCabalT (liftCabal inputDebianization) atoms)
                  diff <- diffDebianizations (view debInfo (testDeb2 atoms)) (view debInfo deb)
-                 assertEqual label [] diff)
+                 assertEmptyDiff label diff)
     where
       testDeb2 :: CabalInfo -> CabalInfo
       testDeb2 atoms =
@@ -400,7 +400,7 @@
                  new <- withCurrentDirectory inTop $ do
                           execCabalT (debianize (defaultAtoms >> customize log)) atoms
                  diff <- diffDebianizations (view debInfo old) (view debInfo ({-copyFirstLogEntry old-} new))
-                 assertEqual label [] diff)
+                 assertEmptyDiff label diff)
     where
       customize :: Maybe ChangeLog -> CabalT IO ()
       customize log =
@@ -507,7 +507,7 @@
                      level = view D.compat old
                  new <- withCurrentDirectory inTop (execCabalT (debianize (defaultAtoms >> customize old level standards)) atoms)
                  diff <- diffDebianizations old (view debInfo new)
-                 assertEqual label [] diff)
+                 assertEmptyDiff label diff)
     where
       customize old level standards =
           do (A.debInfo . D.utilsPackageNameBase) .= Just "creativeprompts-data"
@@ -604,7 +604,7 @@
                   let log = view D.changelog old
                   new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= execCabalT (debianize (defaultAtoms >> customize log))
                   diff <- diffDebianizations old (view debInfo new)
-                  assertEqual label [] diff
+                  assertEmptyDiff label diff
              )
     where
       customize Nothing = error "Missing changelog"
@@ -624,7 +624,7 @@
                  let Just (ChangeLog (entry : _)) = view (debInfo . D.changelog) new
                  old <- withCurrentDirectory outTop $ newFlags >>= execDebianT (inputDebianization >> copyChangelogDate (logDate entry)) . D.makeDebInfo
                  diff <- diffDebianizations old (view debInfo new)
-                 assertEqual label [] diff)
+                 assertEmptyDiff label diff)
     where
       customize =
           do newDebianization' (Just 9) (Just (StandardsVersion 3 9 6 Nothing))
@@ -661,7 +661,7 @@
                  let Just (ChangeLog (entry : _)) = view D.changelog old
                  new <- withCurrentDirectory inTop $ newFlags >>= newCabalInfo >>= execCabalT (debianize (defaultAtoms >> customize >> (liftCabal $ copyChangelogDate $ logDate entry)))
                  diff <- diffDebianizations old (view debInfo new)
-                 assertEqual label [] diff)
+                 assertEmptyDiff label diff)
     where
       customize :: CabalT IO ()
       customize =
@@ -722,5 +722,19 @@
 sortBinaryDebs = (D.control . S.binaryPackages) %= sortBy (compare `on` view B.package)
 
 main :: IO ()
-main = runTestTT tests >>= putStrLn . show
+main = do
+ counts <- runTestTT tests
+ exitWith $ if errors counts + failures counts > 0
+            then ExitFailure 1
+            else ExitSuccess
 
+
+-- Cusstom HUnit assertion, which prints the diffs without using 'show'
+assertEmptyDiff :: String -- ^ The message prefix
+                -> String -- ^ The actual diff
+                -> Assertion
+assertEmptyDiff preface "" = return ()
+assertEmptyDiff preface diff = assertFailure $
+ (if null preface then "" else preface ++ "\n") ++
+ "diff not empty:\n" ++
+ diff
diff --git a/cabal-debian.cabal b/cabal-debian.cabal
--- a/cabal-debian.cabal
+++ b/cabal-debian.cabal
@@ -1,5 +1,5 @@
 Name:           cabal-debian
-Version:        4.31.2
+Version:        4.31.3
 Copyright:      Copyright (c) 2007-2014, David Fox, Jeremy Shaw
 License:        BSD3
 License-File:   LICENSE
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+haskell-cabal-debian (4.31.3) unstable; urgency=low
+
+  * Fix error message formatting (Joachim Breitner)
+  * Fix test suite result code (Joachim Breitner)
+
+ -- David Fox <dsf@seereason.com>  Fri, 21 Aug 2015 17:29:57 -0700
+
 haskell-cabal-debian (4.31.2) unstable; urgency=low
 
   * Fix some names in Extra-Source-Files and add some missing ones.
