|
1 | 1 | {-# LANGUAGE OverloadedStrings #-}
|
2 |
| -{-# LANGUAGE CPP #-} |
3 | 2 |
|
4 | 3 | module FunctionalCodeActionsSpec where
|
5 | 4 |
|
@@ -219,51 +218,50 @@ spec = describe "code actions" $ do
|
219 | 218 | , " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
|
220 | 219 | ]
|
221 | 220 | ]
|
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 | + |
267 | 265 | describe "add package suggestions" $ do
|
268 | 266 | it "adds to .cabal files" $ do
|
269 | 267 | flushStackEnvironment
|
|
0 commit comments