Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 3978177

Browse files
authored
Removed CPP guards in favor of ghcVersion check
1 parent ba76fab commit 3978177

File tree

1 file changed

+44
-46
lines changed

1 file changed

+44
-46
lines changed

test/functional/FunctionalCodeActionsSpec.hs

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE OverloadedStrings #-}
2-
{-# LANGUAGE CPP #-}
32

43
module FunctionalCodeActionsSpec where
54

@@ -219,51 +218,50 @@ spec = describe "code actions" $ do
219218
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
220219
]
221220
]
222-
#if __GLASGOW_HASKELL__ >= 806
223-
describe "formats with ormolu" $ hsImportSpec "ormolu"
224-
[ -- Expected output for simple format.
225-
[ "import Control.Monad"
226-
, "import qualified Data.Maybe"
227-
, "main :: IO ()"
228-
, "main = when True $ putStrLn \"hello\""
229-
]
230-
, -- Use an import list and format the output.
231-
[ "import Control.Monad (when)"
232-
, "import qualified Data.Maybe"
233-
, "main :: IO ()"
234-
, "main = when True $ putStrLn \"hello\""
235-
]
236-
, -- Multiple import lists, should not introduce multiple newlines.
237-
[ "import System.IO (hPutStrLn, stdout)"
238-
, "import Control.Monad (when)"
239-
, "import Data.Maybe (fromMaybe)"
240-
, "-- | Main entry point to the program"
241-
, "main :: IO ()"
242-
, "main ="
243-
, " when True"
244-
, " $ hPutStrLn stdout"
245-
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
246-
]
247-
, -- Complex imports for Constructos and functions
248-
[ "{-# LANGUAGE NoImplicitPrelude #-}"
249-
, "import System.IO (IO, hPutStrLn, stderr)"
250-
, "import Prelude (Bool (..))"
251-
, "import Control.Monad (when)"
252-
, "import Data.Function (($))"
253-
, "import Data.Maybe (Maybe (Just), fromMaybe)"
254-
, "-- | Main entry point to the program"
255-
, "main :: IO ()"
256-
, "main ="
257-
, " when True"
258-
, " $ hPutStrLn stderr"
259-
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
260-
]
261-
]
262-
#else
263-
describe "formats with ormolu" $
264-
it "is NOP formatter" $
265-
pendingWith "Ormolu only supported by GHC >= 8.6. Need to restore this."
266-
#endif
221+
describe "formats with ormolu" $
222+
case ghcVersion of
223+
GHC86 -> hsImportSpec "ormolu"
224+
[ -- Expected output for simple format.
225+
[ "import Control.Monad"
226+
, "import qualified Data.Maybe"
227+
, "main :: IO ()"
228+
, "main = when True $ putStrLn \"hello\""
229+
]
230+
, -- Use an import list and format the output.
231+
[ "import Control.Monad (when)"
232+
, "import qualified Data.Maybe"
233+
, "main :: IO ()"
234+
, "main = when True $ putStrLn \"hello\""
235+
]
236+
, -- Multiple import lists, should not introduce multiple newlines.
237+
[ "import System.IO (hPutStrLn, stdout)"
238+
, "import Control.Monad (when)"
239+
, "import Data.Maybe (fromMaybe)"
240+
, "-- | Main entry point to the program"
241+
, "main :: IO ()"
242+
, "main ="
243+
, " when True"
244+
, " $ hPutStrLn stdout"
245+
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
246+
]
247+
, -- Complex imports for Constructos and functions
248+
[ "{-# LANGUAGE NoImplicitPrelude #-}"
249+
, "import System.IO (IO, hPutStrLn, stderr)"
250+
, "import Prelude (Bool (..))"
251+
, "import Control.Monad (when)"
252+
, "import Data.Function (($))"
253+
, "import Data.Maybe (Maybe (Just), fromMaybe)"
254+
, "-- | Main entry point to the program"
255+
, "main :: IO ()"
256+
, "main ="
257+
, " when True"
258+
, " $ hPutStrLn stderr"
259+
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
260+
]
261+
]
262+
_ -> it "is NOP formatter" $
263+
pendingWith "Ormolu only supported by GHC >= 8.6. Need to restore this."
264+
267265
describe "add package suggestions" $ do
268266
it "adds to .cabal files" $ do
269267
flushStackEnvironment

0 commit comments

Comments
 (0)