@@ -1281,22 +1281,35 @@ pluginTests = testSessionWait "plugins" $ do
12811281
12821282cppTests :: TestTree
12831283cppTests =
1284− testCase "cpp" $ do
1285− let content =
1286− T.unlines
1287− [ "{-# LANGUAGE CPP #-}",
1288− "module Testing where",
1289− "#ifdef FOO",
1290− "foo = 42"
1291− ]
1292− -- The error locations differ depending on which C-preprocessor is used.
1293− -- Some give the column number and others don't (hence -1). Assert either
1294− -- of them.
1295− (run $ expectError content (2, -1))
1296− `catch` ( \e -> do
1297− let _ = e :: HUnitFailure
1298− run $ expectError content (2, 1)
1299− )
1284+ testGroup "cpp"
1285+ [ testCase "cpp-error" $ do
1286+ let content =
1287+ T.unlines
1288+ [ "{-# LANGUAGE CPP #-}",
1289+ "module Testing where",
1290+ "#ifdef FOO",
1291+ "foo = 42"
1292+ ]
1293+ -- The error locations differ depending on which C-preprocessor is used.
1294+ -- Some give the column number and others don't (hence -1). Assert either
1295+ -- of them.
1296+ (run $ expectError content (2, -1))
1297+ `catch` ( \e -> do
1298+ let _ = e :: HUnitFailure
1299+ run $ expectError content (2, 1)
1300+ )
1301+ , testSessionWait "cpp-ghcide" $ do
1302+ _ <- openDoc' "A.hs" "haskell" $ T.unlines
1303+ ["{-# LANGUAGE CPP #-}"
1304+ ,"main ="
1305+ ,"#ifdef __GHCIDE__"
1306+ ," worked"
1307+ ,"#else"
1308+ ," failed"
1309+ ,"#endif"
1310+ ]
1311+ expectDiagnostics [("A.hs", [(DsError, (3, 2), "Variable not in scope: worked")])]
1312+ ]
13001313 where
13011314 expectError :: T.Text -> Cursor -> Session ()
13021315 expectError content cursor = do