Skip to content

Commit 2e02fa2

Browse files
committed
refactor onlyWorkForGhcVersions
1 parent 7e875ec commit 2e02fa2

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

hls-test-utils/src/Test/Hls/Util.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ ignoreForGhcVersions :: [GhcVersion] -> String -> TestTree -> TestTree
153153
ignoreForGhcVersions vers = ignoreInEnv (map GhcVer vers)
154154

155155
-- | Mark as broken if GHC does not match only work versions.
156-
onlyWorkForGhcVersions :: [GhcVersion] -> String -> TestTree -> TestTree
157-
onlyWorkForGhcVersions vers reason =
158-
if ghcVersion `elem` vers
156+
onlyWorkForGhcVersions :: (GhcVersion -> Bool) -> String -> TestTree -> TestTree
157+
onlyWorkForGhcVersions pred reason =
158+
if pred ghcVersion
159159
then id
160160
else expectFailBecause reason
161161

plugins/hls-gadt-plugin/test/Main.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ tests = testGroup "GADT"
3535
, runTest "ConstuctorContext" "ConstructorContext" 2 0 2 38
3636
, runTest "Context" "Context" 2 0 4 41
3737
, runTest "Pragma" "Pragma" 2 0 3 29
38-
, onlyWorkForGhcVersions [GHC92] "Single deriving has different output on ghc9.2" $
38+
, onlyWorkForGhcVersions (==GHC92) "Single deriving has different output on ghc9.2" $
3939
runTest "SingleDerivingGHC92" "SingleDerivingGHC92" 2 0 3 14
40-
, knownBrokenForGhcVersions [GHC92] "Single deriving has different output on ghc9.2" $
40+
, knownBrokenForGhcVersions (==GHC92) "Single deriving has different output on ghc9.2" $
4141
runTest "SingleDeriving" "SingleDeriving" 2 0 3 14
42-
, onlyWorkForGhcVersions [GHC92] "only ghc-9.2 enabled GADTs pragma implicitly" $
42+
, onlyWorkForGhcVersions (==GHC92) "only ghc-9.2 enabled GADTs pragma implicitly" $
4343
gadtPragmaTest "ghc-9.2 don't need to insert GADTs pragma" False
44-
, knownBrokenForGhcVersions [GHC92] "ghc-9.2 has enabled GADTs pragma implicitly" $
44+
, knownBrokenForGhcVersions (==GHC92) "ghc-9.2 has enabled GADTs pragma implicitly" $
4545
gadtPragmaTest "insert pragma" True
4646
]
4747

plugins/hls-pragmas-plugin/test/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ completionTests =
116116
, completionTest "completes language extensions case insensitive" "Completion.hs" "lAnGuaGe Overloaded" "OverloadedStrings" Nothing Nothing Nothing [0, 4, 0, 34, 0, 24]
117117
, completionTest "completes the Strict language extension" "Completion.hs" "Str" "Strict" Nothing Nothing Nothing [0, 13, 0, 31, 0, 16]
118118
, completionTest "completes No- language extensions" "Completion.hs" "NoOverload" "NoOverloadedStrings" Nothing Nothing Nothing [0, 13, 0, 31, 0, 23]
119-
, onlyWorkForGhcVersions [GHC92] "GHC2021 flag introduced since ghc9.2" $
119+
, onlyWorkForGhcVersions (==GHC92) "GHC2021 flag introduced since ghc9.2" $
120120
completionTest "completes GHC2021 extensions" "Completion.hs" "ghc" "GHC2021" Nothing Nothing Nothing [0, 13, 0, 31, 0, 16]
121121
]
122122

0 commit comments

Comments
 (0)