summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2016-07-23 10:44:25 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2016-07-23 10:44:25 +0200
commit7d0f24a3e3a01db3e6ff3858518a0fd715380c83 (patch)
tree3dda515c23aa02b0141ee3a7a925c443f39a4662 /tests
parent82943538ba7570dfadd8b3deb501bd67537c57b0 (diff)
downloadstylish-haskell-7d0f24a3e3a01db3e6ff3858518a0fd715380c83.tar.gz
Move records step into simple_align
Diffstat (limited to 'tests')
-rw-r--r--tests/Language/Haskell/Stylish/Step/Records/Tests.hs100
-rw-r--r--tests/Language/Haskell/Stylish/Step/SimpleAlign/Tests.hs85
-rw-r--r--tests/TestSuite.hs2
3 files changed, 82 insertions, 105 deletions
diff --git a/tests/Language/Haskell/Stylish/Step/Records/Tests.hs b/tests/Language/Haskell/Stylish/Step/Records/Tests.hs
deleted file mode 100644
index 5b24c2f..0000000
--- a/tests/Language/Haskell/Stylish/Step/Records/Tests.hs
+++ /dev/null
@@ -1,100 +0,0 @@
---------------------------------------------------------------------------------
-module Language.Haskell.Stylish.Step.Records.Tests
- ( tests
- ) where
-
-
---------------------------------------------------------------------------------
-import Test.Framework (Test, testGroup)
-import Test.Framework.Providers.HUnit (testCase)
-import Test.HUnit (Assertion, (@=?))
-
-
---------------------------------------------------------------------------------
-import Language.Haskell.Stylish.Step.Records
-import Language.Haskell.Stylish.Tests.Util
-
-
---------------------------------------------------------------------------------
-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 80) input
- where
- input = unlines
- [ "data Foo = Foo"
- , " { foo :: Int"
- , " , barqux :: String"
- , " } deriving (Show)"
- ]
-
- expected = unlines
- [ "data Foo = Foo"
- , " { foo :: Int"
- , " , barqux :: String"
- , " } deriving (Show)"
- ]
-
-
---------------------------------------------------------------------------------
-case02 :: Assertion
-case02 = input @=? testStep (step 80) input
- where
- -- Don't attempt to align this since a field spans multiple lines
- input = unlines
- [ "data Foo = Foo"
- , " { foo :: Int"
- , " , barqux"
- , " :: 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"
- , " }"
- ]
diff --git a/tests/Language/Haskell/Stylish/Step/SimpleAlign/Tests.hs b/tests/Language/Haskell/Stylish/Step/SimpleAlign/Tests.hs
index b36f5d9..a57e6e9 100644
--- a/tests/Language/Haskell/Stylish/Step/SimpleAlign/Tests.hs
+++ b/tests/Language/Haskell/Stylish/Step/SimpleAlign/Tests.hs
@@ -5,9 +5,9 @@ module Language.Haskell.Stylish.Step.SimpleAlign.Tests
--------------------------------------------------------------------------------
-import Test.Framework (Test, testGroup)
-import Test.Framework.Providers.HUnit (testCase)
-import Test.HUnit (Assertion, (@=?))
+import Test.Framework (Test, testGroup)
+import Test.Framework.Providers.HUnit (testCase)
+import Test.HUnit (Assertion, (@=?))
--------------------------------------------------------------------------------
@@ -21,6 +21,10 @@ tests = testGroup "Language.Haskell.Stylish.Step.SimpleAlign.Tests"
[ testCase "case 01" case01
, testCase "case 02" case02
, testCase "case 03" case03
+ , testCase "case 04" case04
+ , testCase "case 05" case05
+ , testCase "case 06" case06
+ , testCase "case 07" case07
]
@@ -69,3 +73,78 @@ case03 = expected @=? testStep (step 80 defaultConfig) input
[ "heady def [] = def"
, "heady _ (x : _) = x"
]
+
+
+--------------------------------------------------------------------------------
+case04 :: Assertion
+case04 = expected @=? testStep (step 80 defaultConfig) input
+ where
+ input = unlines
+ [ "data Foo = Foo"
+ , " { foo :: Int"
+ , " , barqux :: String"
+ , " } deriving (Show)"
+ ]
+
+ expected = unlines
+ [ "data Foo = Foo"
+ , " { foo :: Int"
+ , " , barqux :: String"
+ , " } deriving (Show)"
+ ]
+
+
+--------------------------------------------------------------------------------
+case05 :: Assertion
+case05 = input @=? testStep (step 80 defaultConfig) input
+ where
+ -- Don't attempt to align this since a field spans multiple lines
+ input = unlines
+ [ "data Foo = Foo"
+ , " { foo :: Int"
+ , " , barqux"
+ , " :: String"
+ , " } deriving (Show)"
+ ]
+
+
+--------------------------------------------------------------------------------
+case06 :: Assertion
+case06 =
+ -- 22 max columns is /just/ enough to align this stuff.
+ expected @=? testStep (step 22 defaultConfig) input
+ where
+ input = unlines
+ [ "data Foo = Foo"
+ , " { foo :: String"
+ , " , barqux :: Int"
+ , " }"
+ ]
+
+ expected = unlines
+ [ "data Foo = Foo"
+ , " { foo :: String"
+ , " , barqux :: Int"
+ , " }"
+ ]
+
+
+--------------------------------------------------------------------------------
+case07 :: Assertion
+case07 =
+ -- 21 max columns is /just NOT/ enough to align this stuff.
+ expected @=? testStep (step 21 defaultConfig) input
+ where
+ input = unlines
+ [ "data Foo = Foo"
+ , " { foo :: String"
+ , " , barqux :: Int"
+ , " }"
+ ]
+
+ expected = unlines
+ [ "data Foo = Foo"
+ , " { foo :: String"
+ , " , barqux :: Int"
+ , " }"
+ ]
diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs
index d739760..853126d 100644
--- a/tests/TestSuite.hs
+++ b/tests/TestSuite.hs
@@ -12,7 +12,6 @@ import Test.Framework (default
import qualified Language.Haskell.Stylish.Parse.Tests
import qualified Language.Haskell.Stylish.Step.Imports.Tests
import qualified Language.Haskell.Stylish.Step.LanguagePragmas.Tests
-import qualified Language.Haskell.Stylish.Step.Records.Tests
import qualified Language.Haskell.Stylish.Step.SimpleAlign.Tests
import qualified Language.Haskell.Stylish.Step.Tabs.Tests
import qualified Language.Haskell.Stylish.Step.TrailingWhitespace.Tests
@@ -25,7 +24,6 @@ main = defaultMain
[ Language.Haskell.Stylish.Parse.Tests.tests
, Language.Haskell.Stylish.Step.Imports.Tests.tests
, Language.Haskell.Stylish.Step.LanguagePragmas.Tests.tests
- , Language.Haskell.Stylish.Step.Records.Tests.tests
, Language.Haskell.Stylish.Step.SimpleAlign.Tests.tests
, Language.Haskell.Stylish.Step.Tabs.Tests.tests
, Language.Haskell.Stylish.Step.TrailingWhitespace.Tests.tests