Skip to content

Commit 9b7ecbd

Browse files
committed
Rename to TxFwdBwd
1 parent cf1f12a commit 9b7ecbd

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

cabal-testsuite/PackageTests/CheckSetup/setup.test.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ main = cabalTest $ do
1515

1616
-- Replace line breaks with spaces in the haystack so that we can search
1717
-- for a string that wraps lines.
18-
let lineBreakBlind = needleHaystack{txHaystack = txContainsId{txFwd = lineBreaksToSpaces}}
18+
let lineBreakBlind = needleHaystack{txHaystack = txFwdBwdId{txFwd = lineBreaksToSpaces}}
1919

2020
-- Asserts for the desired check messages after configure.
2121
assertOn lineBreakBlind libError1 checkResult

cabal-testsuite/src/Test/Cabal/NeedleHaystack.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
-- for the strings to search in and the search strings such as re-encoding line
77
-- breaks or delimiting lines. Both LF and CRLF line breaks are recognized.
88
module Test.Cabal.NeedleHaystack
9-
( TxContains(..)
10-
, txContainsId
9+
( TxFwdBwd(..)
10+
, txFwdBwdId
1111
, NeedleHaystack(..)
1212
, NeedleHaystackCompare
1313
, symNeedleHaystack
@@ -131,8 +131,8 @@ or isn't found in the test output.
131131
type NeedleHaystackCompare = String -> String -> Bool
132132

133133
-- | Transformations for the search strings and the text to search in.
134-
data TxContains =
135-
TxContains
134+
data TxFwdBwd =
135+
TxFwdBwd
136136
{
137137
-- | Reverse conversion for display, applied to the forward converted value.
138138
txBwd :: (String -> String),
@@ -142,8 +142,8 @@ data TxContains =
142142

143143
-- | Identity transformation for the search strings and the text to search in,
144144
-- leaves them unchanged.
145-
txContainsId :: TxContains
146-
txContainsId = TxContains id id
145+
txFwdBwdId :: TxFwdBwd
146+
txFwdBwdId = TxFwdBwd id id
147147

148148
-- | Conversions of the needle and haystack strings, the seach string and the
149149
-- text to search in.
@@ -152,14 +152,14 @@ data NeedleHaystack =
152152
{
153153
expectNeedleInHaystack :: Bool,
154154
displayHaystack :: Bool,
155-
txNeedle :: TxContains,
156-
txHaystack :: TxContains
155+
txNeedle :: TxFwdBwd,
156+
txHaystack :: TxFwdBwd
157157
}
158158

159159
-- | Symmetric needle and haystack functions, the same conversion for each going
160160
-- forward and the same coversion for each going backward.
161161
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
163163

164164
-- | Multiline needle and haystack functions with symmetric conversions. Going
165165
-- forward converts line breaks to @"\\n"@. Going backward adds visible
@@ -170,7 +170,7 @@ multilineNeedleHaystack = symNeedleHaystack delimitLines encodeLf
170170
-- | Minimal set up for finding the needle in the haystack. Doesn't change the
171171
-- strings and doesn't display the haystack in any assertion failure message.
172172
needleHaystack :: NeedleHaystack
173-
needleHaystack = NeedleHaystack True False txContainsId txContainsId
173+
needleHaystack = NeedleHaystack True False txFwdBwdId txFwdBwdId
174174

175175
-- | Replace line breaks with spaces, correctly handling @"\\r\\n"@.
176176
--

cabal-testsuite/src/Test/Cabal/Prelude.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,12 @@ recordMode mode = withReaderT (\env -> env {
807807
-- See Note [Multiline Needles]
808808
assertOutputContains :: MonadIO m => WithCallStack (String -> Result -> m ())
809809
assertOutputContains = assertOn isInfixOf needleHaystack
810-
{txHaystack = TxContains{txBwd = delimitLines, txFwd = encodeLf}}
810+
{txHaystack = TxFwdBwd{txBwd = delimitLines, txFwd = encodeLf}}
811811

812812
assertOutputDoesNotContain :: MonadIO m => WithCallStack (String -> Result -> m ())
813813
assertOutputDoesNotContain = assertOn isInfixOf needleHaystack
814814
{ expectNeedleInHaystack = False
815-
, txHaystack = TxContains{txBwd = delimitLines, txFwd = encodeLf}
815+
, txHaystack = TxFwdBwd{txBwd = delimitLines, txFwd = encodeLf}
816816
}
817817

818818
-- See Note [Multiline Needles]
@@ -833,15 +833,15 @@ assertOn isIn NeedleHaystack{..} (txFwd txNeedle -> needle) (txFwd txHaystack. r
833833

834834
assertOutputMatches :: MonadIO m => WithCallStack (String -> Result -> m ())
835835
assertOutputMatches = assertOn (flip (=~)) needleHaystack
836-
{ txNeedle = TxContains{txBwd = ("regex match with '" ++) . (++ "'"), txFwd = id}
837-
, txHaystack = TxContains{txBwd = delimitLines, txFwd = encodeLf}
836+
{ txNeedle = TxFwdBwd{txBwd = ("regex match with '" ++) . (++ "'"), txFwd = id}
837+
, txHaystack = TxFwdBwd{txBwd = delimitLines, txFwd = encodeLf}
838838
}
839839

840840
assertOutputDoesNotMatch :: MonadIO m => WithCallStack (String -> Result -> m ())
841841
assertOutputDoesNotMatch = assertOn (flip (=~)) needleHaystack
842842
{ expectNeedleInHaystack = False
843-
, txNeedle = TxContains{txBwd = ("regex match with '" ++) . (++ "'"), txFwd = id}
844-
, txHaystack = TxContains{txBwd = delimitLines, txFwd = encodeLf}
843+
, txNeedle = TxFwdBwd{txBwd = ("regex match with '" ++) . (++ "'"), txFwd = id}
844+
, txHaystack = TxFwdBwd{txBwd = delimitLines, txFwd = encodeLf}
845845
}
846846

847847
assertFindInFile :: MonadIO m => WithCallStack (String -> FilePath -> m ())

0 commit comments

Comments
 (0)