@@ -63,6 +63,7 @@ main = defaultMainWithRerun $ testGroup "HIE"
6363 , pluginTests
6464 , preprocessorTests
6565 , thTests
66+ , safeTests
6667 , unitTests
6768 , haddockTests
6869 , positionMappingTests
@@ -1485,6 +1486,36 @@ preprocessorTests = testSessionWait "preprocessor" $ do
14851486 )
14861487 ]
14871488
1489+
1490+safeTests :: TestTree
1491+safeTests =
1492+ testGroup
1493+ "SafeHaskell"
1494+ [ -- Test for https://github.com/digital-asset/ghcide/issues/424
1495+ testSessionWait "load" $ do
1496+ let sourceA =
1497+ T.unlines
1498+ ["{-# LANGUAGE Trustworthy #-}"
1499+ ,"module A where"
1500+ ,"import System.IO.Unsafe"
1501+ ,"import System.IO"
1502+ ,"trustWorthyId :: a -> a"
1503+ ,"trustWorthyId i = unsafePerformIO $ do"
1504+ ," putStrLn \"I'm safe\""
1505+ ," return i"]
1506+ sourceB =
1507+ T.unlines
1508+ ["{-# LANGUAGE Safe #-}"
1509+ ,"module B where"
1510+ ,"import A"
1511+ ,"safeId :: a -> a"
1512+ ,"safeId = trustWorthyId"
1513+ ]
1514+
1515+ _ <- openDoc' "A.hs" "haskell" sourceA
1516+ _ <- openDoc' "B.hs" "haskell" sourceB
1517+ expectNoMoreDiagnostics 1 ]
1518+
14881519thTests :: TestTree
14891520thTests =
14901521 testGroup