diff options
author | Artyom Kazak <yom@artyom.me> | 2017-04-24 13:51:40 +0300 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2017-04-24 12:51:40 +0200 |
commit | 6888814f309f206d6b9860f3ae9b5e6c8525f17b (patch) | |
tree | 9eef3ea0ab4daaed24a0e9d410c04e2bd7791c3a /tests | |
parent | d10ebd066bfb93ae8e0a155c45da3c574a431911 (diff) | |
download | stylish-haskell-6888814f309f206d6b9860f3ae9b5e6c8525f17b.tar.gz |
Take package imports into account when prettifying imports
Fixes #106
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Language/Haskell/Stylish/Step/Imports/Tests.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs index e1a7462..02f7076 100644 --- a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs +++ b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs @@ -48,6 +48,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests" , testCase "case 19d" case19d , testCase "case 20" case20 , testCase "case 21" case21 + , testCase "case 22" case22 ] @@ -562,3 +563,29 @@ case21 = expected , "import X8 (type (+), (+))" , "import X9 hiding (x, y, z, x)" ] + +-------------------------------------------------------------------------------- +case22 :: Assertion +case22 = expected + @=? testStep (step 80 defaultOptions) input' + where + expected = unlines + [ "{-# LANGUAGE PackageImports #-}" + , "import A" + , "import \"blah\" A" + , "import \"foo\" A" + , "import qualified \"foo\" A as X" + , "import \"foo\" B (shortName, someLongName, someLongerName," + , " theLongestNameYet)" + ] + input' = unlines + [ "{-# LANGUAGE PackageImports #-}" + , "import A" + , "import \"foo\" A" + , "import \"blah\" A" + , "import qualified \"foo\" A as X" + -- this import fits into 80 chats without "foo", + -- but doesn't fit when "foo" is included into the calculation + , "import \"foo\" B (someLongName, someLongerName, " ++ + "theLongestNameYet, shortName)" + ] |