Skip to content

Commit f6c3800

Browse files
committed
Refactor Squash tests
1 parent 70a7755 commit f6c3800

File tree

1 file changed

+59
-78
lines changed
  • tests/Language/Haskell/Stylish/Step/Squash

1 file changed

+59
-78
lines changed
Lines changed: 59 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
--------------------------------------------------------------------------------
2+
{-# LANGUAGE OverloadedLists #-}
23
module Language.Haskell.Stylish.Step.Squash.Tests
34
( tests
45
) where
56

67

78
--------------------------------------------------------------------------------
8-
import Test.Framework (Test, testGroup)
9-
import Test.Framework.Providers.HUnit (testCase)
10-
import Test.HUnit (Assertion, (@=?))
9+
import Test.Framework (Test, testGroup)
10+
import Test.Framework.Providers.HUnit (testCase)
11+
import Test.HUnit (Assertion)
1112

1213

1314
--------------------------------------------------------------------------------
@@ -28,94 +29,74 @@ tests = testGroup "Language.Haskell.Stylish.Step.SimpleSquash.Tests"
2829

2930
--------------------------------------------------------------------------------
3031
case01 :: Assertion
31-
case01 = expected @=? testStep step input
32-
where
33-
input = unlines
34-
[ "data Foo = Foo"
35-
, " { foo :: Int"
36-
, " , barqux :: String"
37-
, " } deriving (Show)"
38-
]
39-
40-
expected = unlines
41-
[ "data Foo = Foo"
42-
, " { foo :: Int"
43-
, " , barqux :: String"
44-
, " } deriving (Show)"
45-
]
32+
case01 = assertSnippet step
33+
[ "data Foo = Foo"
34+
, " { foo :: Int"
35+
, " , barqux :: String"
36+
, " } deriving (Show)"
37+
]
38+
[ "data Foo = Foo"
39+
, " { foo :: Int"
40+
, " , barqux :: String"
41+
, " } deriving (Show)"
42+
]
4643

4744

4845
--------------------------------------------------------------------------------
4946
case02 :: Assertion
50-
case02 = expected @=? testStep step input
51-
where
52-
input = unlines
53-
[ "data Foo = Foo"
54-
, " { fooqux"
55-
, " , bar :: String"
56-
, " } deriving (Show)"
57-
]
58-
59-
expected = unlines
60-
[ "data Foo = Foo"
61-
, " { fooqux"
62-
, " , bar :: String"
63-
, " } deriving (Show)"
64-
]
47+
case02 = assertSnippet step
48+
[ "data Foo = Foo"
49+
, " { fooqux"
50+
, " , bar :: String"
51+
, " } deriving (Show)"
52+
]
53+
[ "data Foo = Foo"
54+
, " { fooqux"
55+
, " , bar :: String"
56+
, " } deriving (Show)"
57+
]
6558

6659

6760
--------------------------------------------------------------------------------
6861
case03 :: Assertion
69-
case03 = expected @=? testStep step input
70-
where
71-
input = unlines
72-
[ "maybe y0 f mx ="
73-
, " case mx of"
74-
, " Nothing -> y0"
75-
, " Just x -> f x"
76-
]
77-
78-
expected = unlines
79-
[ "maybe y0 f mx ="
80-
, " case mx of"
81-
, " Nothing -> y0"
82-
, " Just x -> f x"
83-
]
62+
case03 = assertSnippet step
63+
[ "maybe y0 f mx ="
64+
, " case mx of"
65+
, " Nothing -> y0"
66+
, " Just x -> f x"
67+
]
68+
[ "maybe y0 f mx ="
69+
, " case mx of"
70+
, " Nothing -> y0"
71+
, " Just x -> f x"
72+
]
8473

8574

8675
--------------------------------------------------------------------------------
8776
case04 :: Assertion
88-
case04 = expected @=? testStep step input
89-
where
90-
input = unlines
91-
[ "maybe y0 f mx ="
92-
, " case mx of"
93-
, " Nothing ->"
94-
, " y0"
95-
, " Just x ->"
96-
, " f x"
97-
]
98-
99-
expected = unlines
100-
[ "maybe y0 f mx ="
101-
, " case mx of"
102-
, " Nothing ->"
103-
, " y0"
104-
, " Just x ->"
105-
, " f x"
106-
]
77+
case04 = assertSnippet step
78+
[ "maybe y0 f mx ="
79+
, " case mx of"
80+
, " Nothing ->"
81+
, " y0"
82+
, " Just x ->"
83+
, " f x"
84+
]
85+
[ "maybe y0 f mx ="
86+
, " case mx of"
87+
, " Nothing ->"
88+
, " y0"
89+
, " Just x ->"
90+
, " f x"
91+
]
10792

10893

10994
--------------------------------------------------------------------------------
11095
case05 :: Assertion
111-
case05 = expected @=? testStep step input
112-
where
113-
input = unlines
114-
[ "maybe y0 _ Nothing = y"
115-
, "maybe _ f (Just x) = f x"
116-
]
117-
118-
expected = unlines
119-
[ "maybe y0 _ Nothing = y"
120-
, "maybe _ f (Just x) = f x"
121-
]
96+
case05 = assertSnippet step
97+
[ "maybe y0 _ Nothing = y"
98+
, "maybe _ f (Just x) = f x"
99+
]
100+
[ "maybe y0 _ Nothing = y"
101+
, "maybe _ f (Just x) = f x"
102+
]

0 commit comments

Comments
 (0)