@@ -78,6 +78,7 @@ tests = testGroup "Language.Haskell.Stylish.Step.Data.Tests"
7878 , testCase " case 63 (issue #338)" case63
7979 , testCase " case 64" case64
8080 , testCase " case 65" case65
81+ , testCase " case 66 (issue #411)" case66
8182 ]
8283
8384case00 :: Assertion
@@ -424,7 +425,8 @@ case20 = assertSnippet (step indentIndentStyle) input input
424425 input =
425426 [ " module Herp where"
426427 , " "
427- , " data Tag = Title | Text deriving (Eq, Show)"
428+ , " data Tag = Title | Text"
429+ , " deriving (Eq, Show)"
428430 ]
429431
430432case21 :: Assertion
@@ -1161,7 +1163,8 @@ case55 :: Assertion
11611163case55 = assertSnippet (step sameSameNoSortStyle) input expected
11621164 where
11631165 input =
1164- [ " data Foo = Foo deriving (Z, Y, X, Bar, Abcd)"
1166+ [ " data Foo = Foo"
1167+ , " deriving (Z, Y, X, Bar, Abcd)"
11651168 ]
11661169
11671170 expected = input
@@ -1367,6 +1370,17 @@ case65 = assertSnippet (step indentIndentStyle) input input
13671370 , " deriving (Show)"
13681371 ]
13691372
1373+ -- | Deriving alignment for enums
1374+ --
1375+ -- Regression test for https://github.com/haskell/stylish-haskell/issues/411
1376+ case66 :: Assertion
1377+ case66 = assertSnippet (step indentIndentStyle) input input
1378+ where
1379+ input =
1380+ [ " data Foo = A | B | C"
1381+ , " deriving (Eq, Show)"
1382+ ]
1383+
13701384sameSameStyle :: Config
13711385sameSameStyle = Config SameLine SameLine 2 2 False True SameLine False True NoMaxColumns
13721386
0 commit comments