6
6
-- for the strings to search in and the search strings such as re-encoding line
7
7
-- breaks or delimiting lines. Both LF and CRLF line breaks are recognized.
8
8
module Test.Cabal.NeedleHaystack
9
- ( TxContains (.. )
10
- , txContainsId
9
+ ( TxFwdBwd (.. )
10
+ , txFwdBwdId
11
11
, NeedleHaystack (.. )
12
12
, NeedleHaystackCompare
13
13
, symNeedleHaystack
@@ -131,8 +131,8 @@ or isn't found in the test output.
131
131
type NeedleHaystackCompare = String -> String -> Bool
132
132
133
133
-- | Transformations for the search strings and the text to search in.
134
- data TxContains =
135
- TxContains
134
+ data TxFwdBwd =
135
+ TxFwdBwd
136
136
{
137
137
-- | Reverse conversion for display, applied to the forward converted value.
138
138
txBwd :: (String -> String ),
@@ -142,8 +142,8 @@ data TxContains =
142
142
143
143
-- | Identity transformation for the search strings and the text to search in,
144
144
-- leaves them unchanged.
145
- txContainsId :: TxContains
146
- txContainsId = TxContains id id
145
+ txFwdBwdId :: TxFwdBwd
146
+ txFwdBwdId = TxFwdBwd id id
147
147
148
148
-- | Conversions of the needle and haystack strings, the seach string and the
149
149
-- text to search in.
@@ -152,14 +152,14 @@ data NeedleHaystack =
152
152
{
153
153
expectNeedleInHaystack :: Bool ,
154
154
displayHaystack :: Bool ,
155
- txNeedle :: TxContains ,
156
- txHaystack :: TxContains
155
+ txNeedle :: TxFwdBwd ,
156
+ txHaystack :: TxFwdBwd
157
157
}
158
158
159
159
-- | Symmetric needle and haystack functions, the same conversion for each going
160
160
-- forward and the same coversion for each going backward.
161
161
symNeedleHaystack :: (String -> String ) -> (String -> String ) -> NeedleHaystack
162
- symNeedleHaystack bwd fwd = let tx = TxContains bwd fwd in NeedleHaystack True False tx tx
162
+ symNeedleHaystack bwd fwd = let tx = TxFwdBwd bwd fwd in NeedleHaystack True False tx tx
163
163
164
164
-- | Multiline needle and haystack functions with symmetric conversions. Going
165
165
-- forward converts line breaks to @"\\n"@. Going backward adds visible
@@ -170,7 +170,7 @@ multilineNeedleHaystack = symNeedleHaystack delimitLines encodeLf
170
170
-- | Minimal set up for finding the needle in the haystack. Doesn't change the
171
171
-- strings and doesn't display the haystack in any assertion failure message.
172
172
needleHaystack :: NeedleHaystack
173
- needleHaystack = NeedleHaystack True False txContainsId txContainsId
173
+ needleHaystack = NeedleHaystack True False txFwdBwdId txFwdBwdId
174
174
175
175
-- | Replace line breaks with spaces, correctly handling @"\\r\\n"@.
176
176
--
0 commit comments