@@ -2784,13 +2784,39 @@ removeRedundantConstraintsTests = let
27842784 , " in h"
27852785 ]
27862786
2787- typeSignatureMultipleLines :: T. Text
2788- typeSignatureMultipleLines = T. unlines $ header <>
2789- [ " foo :: (Num a, Eq a, Monoid a)"
2790- , " => a -> Bool"
2791- , " foo x = x == 1"
2787+ typeSignatureLined1 = T. unlines $ header <>
2788+ [ " foo :: Eq a =>"
2789+ , " a -> Bool"
2790+ , " foo _ = True"
27922791 ]
27932792
2793+ typeSignatureLined2 = T. unlines $ header <>
2794+ [ " foo :: (Eq a, Show a)"
2795+ , " => a -> Bool"
2796+ , " foo _ = True"
2797+ ]
2798+
2799+ typeSignatureOneLine = T. unlines $ header <>
2800+ [ " foo :: a -> Bool"
2801+ , " foo _ = True"
2802+ ]
2803+
2804+ typeSignatureLined3 = T. unlines $ header <>
2805+ [ " foo :: ( Eq a"
2806+ , " , Show a"
2807+ , " )"
2808+ , " => a -> Bool"
2809+ , " foo x = x == x"
2810+ ]
2811+
2812+ typeSignatureLined3' = T. unlines $ header <>
2813+ [ " foo :: ( Eq a"
2814+ , " )"
2815+ , " => a -> Bool"
2816+ , " foo x = x == x"
2817+ ]
2818+
2819+
27942820 check :: T. Text -> T. Text -> T. Text -> TestTree
27952821 check actionTitle originalCode expectedCode = testSession (T. unpack actionTitle) $ do
27962822 doc <- createDoc " Testing.hs" " haskell" originalCode
@@ -2845,9 +2871,18 @@ removeRedundantConstraintsTests = let
28452871 " Remove redundant constraints `(Monoid a, Show a)` from the context of the type signature for `foo`"
28462872 (typeSignatureSpaces $ Just " Monoid a, Show a" )
28472873 (typeSignatureSpaces Nothing )
2848- , checkPeculiarFormatting
2849- " should do nothing when constraints contain line feeds"
2850- typeSignatureMultipleLines
2874+ , check
2875+ " Remove redundant constraint `Eq a` from the context of the type signature for `foo`"
2876+ typeSignatureLined1
2877+ typeSignatureOneLine
2878+ , check
2879+ " Remove redundant constraints `(Eq a, Show a)` from the context of the type signature for `foo`"
2880+ typeSignatureLined2
2881+ typeSignatureOneLine
2882+ , check
2883+ " Remove redundant constraint `Show a` from the context of the type signature for `foo`"
2884+ typeSignatureLined3
2885+ typeSignatureLined3'
28512886 ]
28522887
28532888addSigActionTests :: TestTree
0 commit comments