Commit cd935e2e authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

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.
parent 24f50cf6
......@@ -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
......
......@@ -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)
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment