@@ -3,6 +3,8 @@ module TriggerSpec (spec) where
33
44import Helper
55
6+ import qualified Data.Text as Text
7+
68import qualified Session
79import Session (Session )
810import Language.Haskell.GhciWrapper (Config (.. ))
@@ -11,7 +13,7 @@ import Trigger hiding (trigger, triggerAll)
1113import qualified Trigger
1214
1315normalize :: String -> [String ]
14- normalize = normalizeTiming . lines
16+ normalize = normalizeTiming . lines . forGhc9dot4
1517 where
1618 normalizeTiming :: [String ] -> [String ]
1719 normalizeTiming = normalizeLine " Finished in "
@@ -23,6 +25,11 @@ normalize = normalizeTiming . lines
2325 | message `isPrefixOf` line = message ++ " ..."
2426 | otherwise = line
2527
28+ forGhc9dot4 :: String -> String
29+ forGhc9dot4 = Text. unpack
30+ . Text. replace " error: Variable not in scope: " " error: [GHC-88464] Variable not in scope: "
31+ . Text. pack
32+
2633withSession :: FilePath -> [String ] -> (Session -> IO a ) -> IO a
2734withSession specPath args = do
2835 Session. withSession ghciConfig {configWorkingDirectory = Just dir} $
@@ -155,19 +162,14 @@ spec = do
155162 it " stops after reloading" $ \ name -> do
156163 withSession name [] $ \ session -> do
157164 writeFile name (passingSpec ++ " foo = bar" )
158- (trigger session >> trigger session) `shouldReturn` (Failure , [
165+
166+ let
167+ fitterNotNull :: [String ] -> [String ]
168+ fitterNotNull = filter (not . null )
169+
170+ (fmap fitterNotNull <$> (trigger session >> trigger session)) `shouldReturn` (Failure , [
159171 " [1 of 1] Compiling Spec"
160- #if __GLASGOW_HASKELL__ < 910
161- , " "
162- #endif
163- #if __GLASGOW_HASKELL__ >= 906
164172 , " Spec.hs:9:7: error: [GHC-88464] Variable not in scope: bar"
165- #else
166- , " Spec.hs:9:7: error: Variable not in scope: bar"
167- #endif
168- #if __GLASGOW_HASKELL__ >= 910
169- , " "
170- #endif
171173 , withColor Red " RELOADING FAILED"
172174 ])
173175
0 commit comments