diff options
author | Maxim Koltsov <kolmax94@gmail.com> | 2020-10-05 01:53:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 00:53:26 +0200 |
commit | 3f4edcce319c3dafd1d1309b281625beb854e8a7 (patch) | |
tree | d58e883d66e4a79612541d3199c2ff143783013a /tests | |
parent | 20dbe3a444a79dc5a8e0bf564b987db5393d127b (diff) | |
download | stylish-haskell-3f4edcce319c3dafd1d1309b281625beb854e8a7.tar.gz |
Fix "group" import sort with multi-line imports
When some import line spans multuple lines, e.g. when import list is
long, stylish-haskell breaks a group at this line, leading to bad
result.
This commits makes sure that import groups are recognized solely by
empty lines.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Language/Haskell/Stylish/Step/Imports/Tests.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs index bb56bab..fea3b78 100644 --- a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs +++ b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs @@ -59,6 +59,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests" , testCase "case 26 (issue 185)" case26 , testCase "case 27" case27 , testCase "case 28" case28 + , testCase "case 29" case29 ] @@ -911,3 +912,25 @@ case28 = expected @=? testSnippet (step (Just 80) $ fromImportAlign Global) inpu , "import Data.Set (empty, intersect)" , "import Data.Set (empty, nub)" ] + + +-------------------------------------------------------------------------------- +case29 :: Assertion +case29 = expected @=? testSnippet (step Nothing $ fromImportAlign Group) input' + where + -- Check that "Group" mode recognizes groups with multi-line imports + input' = Snippet + [ "import Foo (foo)" + , "import BarBar ( bar" + , " , kek)" + , "import Abcd ()" + , "" + , "import A (A)" + ] + expected = Snippet + [ "import Abcd ()" + , "import BarBar (bar, kek)" + , "import Foo (foo)" + , "" + , "import A (A)" + ]
\ No newline at end of file |