@@ -218,6 +218,48 @@ spec = describe "code actions" $ do
218
218
, " $ fromMaybe \" Good night, World!\" (Just \" Hello, World!\" )"
219
219
]
220
220
]
221
+ describe " formats with ormolu" $ hsImportSpec " ormolu"
222
+ [ -- Expected output for simple format.
223
+ [ " import Control.Monad"
224
+ , " import qualified Data.Maybe"
225
+ , " main :: IO ()"
226
+ , " main = when True $ putStrLn \" hello\" "
227
+ ]
228
+ , -- Use an import list and format the output.
229
+ [ " import Control.Monad (when)"
230
+ , " import qualified Data.Maybe"
231
+ , " main :: IO ()"
232
+ , " main = when True $ putStrLn \" hello\" "
233
+ ]
234
+ , -- Multiple import lists, should not introduce multiple newlines.
235
+ -- WIP (Haddock issues) ;TODO
236
+ [ " import System.IO (hPutStrLn, stdout)"
237
+ , " import Control.Monad (when)"
238
+ , " import Data.Maybe (fromMaybe)"
239
+ , " -- | Main entry point to the program"
240
+ , " main :: IO ()"
241
+ , " main ="
242
+ , " when True"
243
+ , " $ hPutStrLn stdout"
244
+ , " $ fromMaybe \" Good night, World!\" (Just \" Hello, World!\" )"
245
+ ]
246
+ , -- Complex imports for Constructos and functions
247
+ -- WIP (Haddock issues) ;TODO
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
+
221
263
describe " add package suggestions" $ do
222
264
it " adds to .cabal files" $ do
223
265
flushStackEnvironment
0 commit comments