From ad0cebe8656682ec3db3de6b94cf6e6247b9bd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Ackerman?= <6054733+akrmn@users.noreply.github.com> Date: Thu, 19 Nov 2020 13:33:32 +0100 Subject: [PATCH] Add failing test cases for post qualified import formatting. Related to #284 and #334 --- .../Haskell/Stylish/Step/Imports/Tests.hs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs index 26cae6e2..a15edbe8 100644 --- a/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs +++ b/tests/Language/Haskell/Stylish/Step/Imports/Tests.hs @@ -65,6 +65,10 @@ tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests" , testCase "case 31" case31 , testCase "case 32" case32 , testCase "case 33" case33 + , testCase "case 34" case34 + , testCase "case 35" case35 + , testCase "case 36" case36 + , testCase "case 37" case37 ] @@ -885,3 +889,37 @@ case33 = assertSnippet (step Nothing defaultOptions {postQualified = True}) , "import Data.Foo (Foo (Bar, Foo), Goo (Goo))" , "import Data.Set (empty, intersect, nub)" ] + +-------------------------------------------------------------------------------- +case34 :: Assertion +case34 = assertSnippet (step Nothing defaultOptions {postQualified = True}) + [ "import qualified Data.Aeson as JSON (Value)" + ] + [ "import Data.Aeson qualified as JSON (Value)" + ] + +-------------------------------------------------------------------------------- +case35 :: Assertion +case35 = assertSnippet (step Nothing defaultOptions {postQualified = True}) + [ "import Data.Aeson qualified as JSON (Value)" + ] + [ "import Data.Aeson qualified as JSON (Value)" + ] + +-------------------------------------------------------------------------------- +case36 :: Assertion +case36 = assertSnippet (step Nothing defaultOptions {postQualified = True}) + [ "import qualified Data.Aeson as JSON (Value)" + , "import qualified Data.Aeson as JSON (encode, decode)" + ] + [ "import Data.Aeson qualified as JSON (Value, decode, encode)" + ] + +-------------------------------------------------------------------------------- +case37 :: Assertion +case37 = assertSnippet (step Nothing defaultOptions {postQualified = True}) + [ "import Data.Aeson qualified as JSON (Value)" + , "import Data.Aeson qualified as JSON (encode, decode)" + ] + [ "import Data.Aeson qualified as JSON (Value, decode, encode)" + ]