Skip to content

Commit 20dbe3a

Browse files
authored
Add a test to cover Imports duplicate removal
Fixes #184
1 parent 2cc5f10 commit 20dbe3a

File tree

1 file changed

+33
-0
lines changed
  • tests/Language/Haskell/Stylish/Step/Imports

1 file changed

+33
-0
lines changed

tests/Language/Haskell/Stylish/Step/Imports/Tests.hs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests"
5858
, testCase "case 25" case25
5959
, testCase "case 26 (issue 185)" case26
6060
, testCase "case 27" case27
61+
, testCase "case 28" case28
6162
]
6263

6364

@@ -878,3 +879,35 @@ case27 = expected @=? testSnippet (step Nothing $ fromImportAlign Global) input
878879
, ""
879880
, "herp = putStrLn \"import Hello world\""
880881
]
882+
883+
884+
--------------------------------------------------------------------------------
885+
case28 :: Assertion
886+
case28 = expected @=? testSnippet (step (Just 80) $ fromImportAlign Global) input'
887+
where
888+
expected = Snippet
889+
[ "import Control.Monad"
890+
, "import qualified Data.Aeson as JSON"
891+
, "import Data.Default.Class (Default (def))"
892+
, ""
893+
, "import Data.Maybe (Maybe (Just, Nothing))"
894+
, "import qualified Data.Maybe.Extra (Maybe (Just, Nothing))"
895+
, ""
896+
, "import Data.Foo (Foo (Bar, Foo), Goo (Goo))"
897+
, "import Data.Set (empty, intersect, nub)"
898+
]
899+
input' = Snippet
900+
[ "import Data.Default.Class (Default(def))"
901+
, "import qualified Data.Aeson as JSON"
902+
, "import qualified Data.Aeson as JSON"
903+
, "import Control.Monad"
904+
, "import Control.Monad"
905+
, ""
906+
, "import Data.Maybe (Maybe (Just, Nothing))"
907+
, "import qualified Data.Maybe.Extra (Maybe(Just, Nothing))"
908+
, ""
909+
, "import Data.Foo (Foo (Foo,Bar), Goo(Goo))"
910+
, "import Data.Foo (Foo (Foo,Bar))"
911+
, "import Data.Set (empty, intersect)"
912+
, "import Data.Set (empty, nub)"
913+
]

0 commit comments

Comments
 (0)