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

Commit 049609d

Browse files
committed
Relax HsImport test to satisfy different import orders
1 parent 27a1a17 commit 049609d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

haskell-ide-engine.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ test-suite func-test
283283
, lens
284284
, text
285285
, unordered-containers
286+
, containers
286287
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wredundant-constraints
287288
if flag(pedantic)
288289
ghc-options: -Werror

test/functional/FunctionalCodeActionsSpec.hs

+13-12
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Control.Monad.IO.Class
99
import Data.Aeson
1010
import Data.Default
1111
import qualified Data.HashMap.Strict as HM
12+
import qualified Data.Set as Set
1213
import Data.Maybe
1314
import Data.Monoid ((<>))
1415
import qualified Data.Text as T
@@ -546,7 +547,7 @@ hsImportSpec formatterName [e1, e2, e3] =
546547
executeAllCodeActions doc wantedCodeActionTitles
547548

548549
contents <- documentContents doc
549-
liftIO $ T.lines contents `shouldBe` e3
550+
liftIO $ Set.fromList (T.lines contents) `shouldBe` Set.fromList e3
550551

551552
it "respects format config, multiple import-list" $ runSession hieCommand fullCaps "test/testdata" $ do
552553
doc <- openDoc "CodeActionImportList.hs" "haskell"
@@ -561,18 +562,18 @@ hsImportSpec formatterName [e1, e2, e3] =
561562
]
562563

563564
executeAllCodeActions doc wantedCodeActionTitles
564-
565565
contents <- documentContents doc
566-
liftIO $ T.lines contents `shouldBe`
567-
[ "import System.IO (stdout, hPutStrLn)"
568-
, "import Control.Monad (when)"
569-
, "import Data.Maybe (fromMaybe)"
570-
, "main :: IO ()"
571-
, "main ="
572-
, " when True"
573-
, " $ hPutStrLn stdout"
574-
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
575-
]
566+
liftIO $ Set.fromList (T.lines contents) `shouldBe`
567+
Set.fromList
568+
[ "import System.IO (stdout, hPutStrLn)"
569+
, "import Control.Monad (when)"
570+
, "import Data.Maybe (fromMaybe)"
571+
, "main :: IO ()"
572+
, "main ="
573+
, " when True"
574+
, " $ hPutStrLn stdout"
575+
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
576+
]
576577
it "respects format config" $ runSession hieCommand fullCaps "test/testdata" $ do
577578
doc <- openDoc "CodeActionImportBrittany.hs" "haskell"
578579
_ <- waitForDiagnosticsSource "ghcmod"

0 commit comments

Comments
 (0)