summaryrefslogtreecommitdiffhomepage
path: root/tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs')
-rw-r--r--tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs59
1 files changed, 49 insertions, 10 deletions
diff --git a/tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs b/tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs
index 2d74813..0ede803 100644
--- a/tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs
+++ b/tests/Language/Haskell/Stylish/Step/LanguagePragmas/Tests.hs
@@ -28,12 +28,16 @@ tests = testGroup "Language.Haskell.Stylish.Step.LanguagePragmas.Tests"
, testCase "case 08" case08
, testCase "case 09" case09
, testCase "case 10" case10
+ , testCase "case 11" case11
+ , testCase "case 12" case12
]
+lANG :: String
+lANG = "LANGUAGE"
--------------------------------------------------------------------------------
case01 :: Assertion
-case01 = expected @=? testStep (step 80 Vertical True False) input
+case01 = expected @=? testStep (step (Just 80) Vertical True False lANG) input
where
input = unlines
[ "{-# LANGUAGE ViewPatterns #-}"
@@ -52,7 +56,7 @@ case01 = expected @=? testStep (step 80 Vertical True False) input
--------------------------------------------------------------------------------
case02 :: Assertion
-case02 = expected @=? testStep (step 80 Vertical True True) input
+case02 = expected @=? testStep (step (Just 80) Vertical True True lANG) input
where
input = unlines
[ "{-# LANGUAGE BangPatterns #-}"
@@ -68,7 +72,7 @@ case02 = expected @=? testStep (step 80 Vertical True True) input
--------------------------------------------------------------------------------
case03 :: Assertion
-case03 = expected @=? testStep (step 80 Vertical True True) input
+case03 = expected @=? testStep (step (Just 80) Vertical True True lANG) input
where
input = unlines
[ "{-# LANGUAGE BangPatterns #-}"
@@ -84,7 +88,7 @@ case03 = expected @=? testStep (step 80 Vertical True True) input
--------------------------------------------------------------------------------
case04 :: Assertion
-case04 = expected @=? testStep (step 80 Compact True False) input
+case04 = expected @=? testStep (step (Just 80) Compact True False lANG) input
where
input = unlines
[ "{-# LANGUAGE TypeOperators, StandaloneDeriving, DeriveDataTypeable,"
@@ -101,7 +105,7 @@ case04 = expected @=? testStep (step 80 Compact True False) input
--------------------------------------------------------------------------------
case05 :: Assertion
-case05 = expected @=? testStep (step 80 Vertical True False) input
+case05 = expected @=? testStep (step (Just 80) Vertical True False lANG) input
where
input = unlines
[ "{-# LANGUAGE CPP #-}"
@@ -122,7 +126,7 @@ case05 = expected @=? testStep (step 80 Vertical True False) input
--------------------------------------------------------------------------------
case06 :: Assertion
-case06 = expected @=? testStep (step 80 CompactLine True False) input
+case06 = expected @=? testStep (step (Just 80) CompactLine True False lANG) input
where
input = unlines
[ "{-# LANGUAGE TypeOperators, StandaloneDeriving, DeriveDataTypeable,"
@@ -137,7 +141,7 @@ case06 = expected @=? testStep (step 80 CompactLine True False) input
--------------------------------------------------------------------------------
case07 :: Assertion
-case07 = expected @=? testStep (step 80 Vertical False False) input
+case07 = expected @=? testStep (step (Just 80) Vertical False False lANG) input
where
input = unlines
[ "{-# LANGUAGE ViewPatterns #-}"
@@ -157,7 +161,7 @@ case07 = expected @=? testStep (step 80 Vertical False False) input
--------------------------------------------------------------------------------
case08 :: Assertion
-case08 = expected @=? testStep (step 80 CompactLine False False) input
+case08 = expected @=? testStep (step (Just 80) CompactLine False False lANG) input
where
input = unlines
[ "{-# LANGUAGE TypeOperators, StandaloneDeriving, DeriveDataTypeable,"
@@ -173,7 +177,7 @@ case08 = expected @=? testStep (step 80 CompactLine False False) input
--------------------------------------------------------------------------------
case09 :: Assertion
-case09 = expected @=? testStep (step 80 Compact True False) input
+case09 = expected @=? testStep (step (Just 80) Compact True False lANG) input
where
input = unlines
[ "{-# LANGUAGE DefaultSignatures, FlexibleInstances, LambdaCase, " ++
@@ -187,7 +191,7 @@ case09 = expected @=? testStep (step 80 Compact True False) input
--------------------------------------------------------------------------------
case10 :: Assertion
-case10 = expected @=? testStep (step 80 Compact True False) input
+case10 = expected @=? testStep (step (Just 80) Compact True False lANG) input
where
input = unlines
[ "{-# LANGUAGE NondecreasingIndentation, ScopedTypeVariables,"
@@ -197,3 +201,38 @@ case10 = expected @=? testStep (step 80 Compact True False) input
[ "{-# LANGUAGE NondecreasingIndentation, ScopedTypeVariables, " ++
"TypeApplications #-}"
]
+
+--------------------------------------------------------------------------------
+case11 :: Assertion
+case11 = expected @=? testStep (step (Just 80) Vertical False False "language") input
+ where
+ input = unlines
+ [ "{-# LANGUAGE ViewPatterns #-}"
+ , "{-# LANGUAGE TemplateHaskell, ViewPatterns #-}"
+ , "{-# LANGUAGE ScopedTypeVariables, NoImplicitPrelude #-}"
+ , "module Main where"
+ ]
+
+ expected = unlines
+ [ "{-# language NoImplicitPrelude #-}"
+ , "{-# language ScopedTypeVariables #-}"
+ , "{-# language TemplateHaskell #-}"
+ , "{-# language ViewPatterns #-}"
+ , "module Main where"
+ ]
+
+--------------------------------------------------------------------------------
+case12 :: Assertion
+case12 = expected @=? testStep (step Nothing Compact False False "language") input
+ where
+ input = unlines
+ [ "{-# LANGUAGE ViewPatterns, OverloadedStrings #-}"
+ , "{-# LANGUAGE TemplateHaskell, ViewPatterns #-}"
+ , "{-# LANGUAGE ScopedTypeVariables, NoImplicitPrelude #-}"
+ , "module Main where"
+ ]
+
+ expected = unlines
+ [ "{-# language NoImplicitPrelude, OverloadedStrings, ScopedTypeVariables, TemplateHaskell, ViewPatterns #-}"
+ , "module Main where"
+ ]