diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2016-07-03 14:06:47 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2016-07-03 18:15:57 +0200 |
commit | ad677e6a22d22041d83162e714c5551c9a4d62d8 (patch) | |
tree | 2ea21ad20b33b8081453e7300fe39a7d5dd0ec38 /tests | |
parent | fd5e7df4896845a113d03cefac9a710d2252aa19 (diff) | |
download | stylish-haskell-ad677e6a22d22041d83162e714c5551c9a4d62d8.tar.gz |
Record alignment takes max columns into account
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Language/Haskell/Stylish/Step/Records/Tests.hs | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/tests/Language/Haskell/Stylish/Step/Records/Tests.hs b/tests/Language/Haskell/Stylish/Step/Records/Tests.hs index 312c6fa..5b24c2f 100644 --- a/tests/Language/Haskell/Stylish/Step/Records/Tests.hs +++ b/tests/Language/Haskell/Stylish/Step/Records/Tests.hs @@ -20,12 +20,14 @@ tests :: Test tests = testGroup "Language.Haskell.Stylish.Step.Records.Tests" [ testCase "case 01" case01 , testCase "case 02" case02 + , testCase "case 03" case03 + , testCase "case 04" case04 ] -------------------------------------------------------------------------------- case01 :: Assertion -case01 = expected @=? testStep step input +case01 = expected @=? testStep (step 80) input where input = unlines [ "data Foo = Foo" @@ -44,7 +46,7 @@ case01 = expected @=? testStep step input -------------------------------------------------------------------------------- case02 :: Assertion -case02 = input @=? testStep step input +case02 = input @=? testStep (step 80) input where -- Don't attempt to align this since a field spans multiple lines input = unlines @@ -54,3 +56,45 @@ case02 = input @=? testStep step input , " :: String" , " } deriving (Show)" ] + + +-------------------------------------------------------------------------------- +case03 :: Assertion +case03 = + -- 22 max columns is /just/ enough to align this stuff. + expected @=? testStep (step 22) input + where + input = unlines + [ "data Foo = Foo" + , " { foo :: String" + , " , barqux :: Int" + , " }" + ] + + expected = unlines + [ "data Foo = Foo" + , " { foo :: String" + , " , barqux :: Int" + , " }" + ] + + +-------------------------------------------------------------------------------- +case04 :: Assertion +case04 = + -- 21 max columns is /just NOT/ enough to align this stuff. + expected @=? testStep (step 21) input + where + input = unlines + [ "data Foo = Foo" + , " { foo :: String" + , " , barqux :: Int" + , " }" + ] + + expected = unlines + [ "data Foo = Foo" + , " { foo :: String" + , " , barqux :: Int" + , " }" + ] |