[commit: packages/Cabal] ghc-head: Test suite: use regexes to match the compiler error message. (cd935e2)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:28:01 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=cd935e2e38fc4629a44811c6d0e4de3cb7b92fe8

>---------------------------------------------------------------

commit cd935e2e38fc4629a44811c6d0e4de3cb7b92fe8
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date:   Tue Jul 9 22:22:11 2013 +0200

    Test suite: use regexes to match the compiler error message.
    
    GHC >= 7.7 outputs Unicode quotation characters when possible (see
    http://ghc.haskell.org/trac/ghc/ticket/2507 ), which breaks tests that rely on
    substring matching.
    
    Alternatively, we can run GHC with 'LC_ALL=C', but I'm not sure whether that'll
    work on Windows.


>---------------------------------------------------------------

cd935e2e38fc4629a44811c6d0e4de3cb7b92fe8
 Cabal/Cabal.cabal                                               |    3 ++-
 Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs |    6 ++++--
 Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs |    4 +++-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal
index c725479..f31950f 100644
--- a/Cabal/Cabal.cabal
+++ b/Cabal/Cabal.cabal
@@ -274,7 +274,8 @@ test-suite package-tests
     directory,
     filepath,
     extensible-exceptions,
-    bytestring
+    bytestring,
+    regex-posix
   if !os(windows)
     build-depends: unix
   ghc-options: -Wall
diff --git a/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs b/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
index 34be0f1..a398f45 100644
--- a/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
+++ b/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
@@ -5,6 +5,7 @@ import PackageTests.PackageTester
 import System.FilePath
 import Data.List
 import qualified Control.Exception as E
+import Text.Regex.Posix
 
 
 suite :: Test
@@ -16,8 +17,9 @@ suite = TestCase $ do
         assertBool "error should be in MyLibrary.hs" $
             "MyLibrary.hs:" `isInfixOf` outputText result
         assertBool "error should be \"Could not find module `System.Time\"" $
-            "Could not find module `System.Time'" `isInfixOf`
-                            (intercalate " " $ lines $ outputText result)
+            (intercalate " " $ lines $ outputText result)
+            =~ "Could not find module.*System.Time"
+
       `E.catch` \exc -> do
         putStrLn $ "Cabal result was "++show result
         E.throwIO (exc :: E.SomeException)
diff --git a/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs b/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
index 01fc094..7d5023a 100644
--- a/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
+++ b/Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
@@ -5,6 +5,7 @@ import PackageTests.PackageTester
 import System.FilePath
 import Data.List
 import qualified Control.Exception as E
+import Text.Regex.Posix
 
 
 suite :: Test
@@ -16,7 +17,8 @@ suite = TestCase $ do
         assertBool "error should be in lemon.hs" $
             "lemon.hs:" `isInfixOf` outputText result
         assertBool "error should be \"Could not find module `System.Time\"" $
-            "Could not find module `System.Time'" `isInfixOf` (intercalate " " $ lines $ outputText result)
+            (intercalate " " $ lines $ outputText result)
+            =~ "Could not find module.*System.Time"
       `E.catch` \exc -> do
         putStrLn $ "Cabal result was "++show result
         E.throwIO (exc :: E.SomeException)





More information about the ghc-commits mailing list