Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 7cf1295

Browse files
committed
Drop CPP directives for GHC 8.2.2 in test folder
1 parent 2d39a8d commit 7cf1295

File tree

5 files changed

+2
-86
lines changed

5 files changed

+2
-86
lines changed

test/functional/FunctionalCodeActionsSpec.hs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE OverloadedStrings #-}
2-
{-# LANGUAGE CPP #-}
32

43
module FunctionalCodeActionsSpec where
54

@@ -213,8 +212,6 @@ spec = describe "code actions" $ do
213212
]
214213
]
215214
describe "add package suggestions" $ do
216-
-- Only execute this test with ghc 8.4.4, below seems to be broken in the package.
217-
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,4,0,0)))
218215
it "adds to .cabal files" $ runSession hieCommand fullCaps "test/testdata/addPackageTest/cabal-exe" $ do
219216
doc <- openDoc "AddPackage.hs" "haskell"
220217

@@ -240,7 +237,7 @@ spec = describe "code actions" $ do
240237

241238
contents <- getDocumentEdit . TextDocumentIdentifier =<< getDocUri "add-package-test.cabal"
242239
liftIO $ T.lines contents `shouldSatisfy` \x -> any (\l -> "text -any" `T.isSuffixOf` (x !! l)) [15, 16]
243-
#endif
240+
244241
it "adds to hpack package.yaml files" $
245242
runSession hieCommand fullCaps "test/testdata/addPackageTest/hpack-exe" $ do
246243
doc <- openDoc "app/Asdf.hs" "haskell"

test/unit/ApplyRefactPluginSpec.hs

-18
Original file line numberDiff line numberDiff line change
@@ -100,31 +100,13 @@ applyRefactSpec = do
100100
PublishDiagnosticsParams
101101
{ _uri = filePath
102102
, _diagnostics = List
103-
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,4,0,0)))
104103
[Diagnostic {_range = Range { _start = Position {_line = 12, _character = 23}
105104
, _end = Position {_line = 12, _character = 100000}}
106105
, _severity = Just DsInfo
107106
, _code = Just (StringValue "parser")
108107
, _source = Just "hlint"
109108
, _message = T.pack filePathNoUri <> ":13:24: error:\n Operator applied to too few arguments: +\n data instance Sing (z :: (a :~: b)) where\n> SRefl :: Sing Refl +\n\n"
110109
, _relatedInformation = Nothing }]}
111-
#elif (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,2,2,0)))
112-
[Diagnostic {_range = Range { _start = Position {_line = 13, _character = 0}
113-
, _end = Position {_line = 13, _character = 100000}}
114-
, _severity = Just DsInfo
115-
, _code = Just (StringValue "parser")
116-
, _source = Just "hlint"
117-
, _message = "Parse error: virtual }\n data instance Sing (z :: (a :~: b)) where\n SRefl :: Sing Refl +\n> \n\n"
118-
, _relatedInformation = Nothing }]}
119-
#else
120-
[Diagnostic {_range = Range { _start = Position {_line = 11, _character = 28}
121-
, _end = Position {_line = 11, _character = 100000}}
122-
, _severity = Just DsInfo
123-
, _code = Just "parser"
124-
, _source = Just "hlint"
125-
, _message = "Parse error: :~:\n import Data.Type.Equality ((:~:) (..), (:~~:) (..))\n \n> data instance Sing (z :: (a :~: b)) where\n SRefl :: Sing Refl +\n\n"
126-
, _relatedInformation = Nothing }]}
127-
#endif
128110
testCommand testPlugins act "applyrefact" "lint" arg res
129111

130112
-- ---------------------------------

test/unit/GhcModPluginSpec.hs

-13
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ module GhcModPluginSpec where
55
import Control.Exception
66
import qualified Data.HashMap.Strict as H
77
import qualified Data.Map as Map
8-
#if __GLASGOW_HASKELL__ < 804
9-
-- import Data.Monoid
10-
#endif
118
import qualified Data.Set as S
129
import qualified Data.Text as T
1310
import Haskell.Ide.Engine.Ghc
@@ -486,11 +483,6 @@ ghcmodSpec =
486483
, (Range (toPos (33, 15)) (toPos (33, 19)), "Int -> Test -> ShowS")
487484
, (Range (toPos (33, 15)) (toPos (33, 19)), "Test -> String")
488485
, (Range (toPos (33, 15)) (toPos (33, 19)), "[Test] -> ShowS")
489-
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,4,0,0)))
490-
#else
491-
, (Range (toPos (33, 15)) (toPos (33, 19)), "Int -> Test -> ShowS")
492-
, (Range (toPos (33, 15)) (toPos (33, 19)), "[Test] -> ShowS")
493-
#endif
494486
]
495487
testCommand testPlugins act "ghcmod" "type" arg res
496488

@@ -505,11 +497,6 @@ ghcmodSpec =
505497
[ (Range (toPos (33, 21)) (toPos (33, 23)), "(Test -> Test -> Bool) -> (Test -> Test -> Bool) -> Eq Test")
506498
, (Range (toPos (33, 21)) (toPos (33, 23)), "Test -> Test -> Bool")
507499
, (Range (toPos (33, 21)) (toPos (33, 23)), "Test -> Test -> Bool")
508-
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,4,0,0)))
509-
#else
510-
, (Range (toPos (33, 21)) (toPos (33, 23)), "Test -> Test -> Bool")
511-
, (Range (toPos (33, 21)) (toPos (33, 23)), "Test -> Test -> Bool")
512-
#endif
513500
]
514501
testCommand testPlugins act "ghcmod" "type" arg res
515502

test/unit/PackagePluginSpec.hs

+1-45
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ packageSpec = do
6464
args = AddParams fp (fp </> "AddPackage.hs") "text"
6565
act = addCmd' args
6666
textEdits =
67-
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,4,0,0)))
6867
List
6968
[ TextEdit (Range (Position 0 0) (Position 7 27)) $ T.concat
7069
[ "cabal-version: >=1.10\n"
@@ -85,25 +84,6 @@ packageSpec = do
8584
, " text -any"
8685
]
8786
]
88-
#else
89-
List -- TODO: this seems to indicate that the command does nothing
90-
[ TextEdit (Range (Position 0 0) (Position 7 27)) $ T.concat
91-
[ "name: add-package-test\n"
92-
, "version: 0.1.0.0\n"
93-
, "cabal-version: >=1.10\n"
94-
, "build-type: Simple\n"
95-
, "license: BSD3\n"
96-
, "maintainer: [email protected]\n"
97-
, "author: Luke Lau\n"
98-
, "extra-source-files:\n"
99-
, " ChangeLog.md"
100-
]
101-
, TextEdit (Range (Position 9 0) (Position 13 34)) $ T.concat
102-
[ "executable AddPackage\n"
103-
, " main-is: AddPackage.hs\n"
104-
]
105-
]
106-
#endif
10787
res = IdeResultOk
10888
$ WorkspaceEdit (Just $ H.singleton uri textEdits) Nothing
10989
testCommand testPlugins act "package" "add" args res
@@ -117,7 +97,6 @@ packageSpec = do
11797
args = AddParams fp (fp </> "AddPackage.hs") "text"
11898
act = addCmd' args
11999
textEdits =
120-
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,4,0,0)))
121100
List
122101
[ TextEdit (Range (Position 0 0) (Position 7 27)) $ T.concat
123102
[ "cabal-version: >=1.10\n"
@@ -139,29 +118,6 @@ packageSpec = do
139118
, " text -any"
140119
]
141120
]
142-
#else
143-
List
144-
[ TextEdit (Range (Position 0 0) (Position 7 27)) $ T.concat
145-
[ "name: add-package-test\n"
146-
, "version: 0.1.0.0\n"
147-
, "cabal-version: >=1.10\n"
148-
, "build-type: Simple\n"
149-
, "license: BSD3\n"
150-
, "maintainer: [email protected]\n"
151-
, "author: Luke Lau\n"
152-
, "extra-source-files:\n"
153-
, " ChangeLog.md"
154-
]
155-
, TextEdit (Range (Position 10 0) (Position 13 34)) $ T.concat
156-
[ " exposed-modules:\n"
157-
, " AddPackage\n"
158-
, " build-depends:\n"
159-
, " base >=4.7 && <5,\n"
160-
, " text -any\n"
161-
, " default-language: Haskell2010\n"
162-
]
163-
]
164-
#endif
165121
res = IdeResultOk
166122
$ WorkspaceEdit (Just $ H.singleton uri textEdits) Nothing
167123
testCommand testPlugins act "package" "add" args res
@@ -239,7 +195,7 @@ packageSpec = do
239195
]
240196
]
241197
testCommand testPlugins act "package" "add" args res
242-
198+
243199
it "Do nothing on NoPackage"
244200
$ withCurrentDirectory (testdata </> "invalid")
245201
$ do

test/utils/TestUtils.hs

-6
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,6 @@ stackYaml =
151151
"stack-8.4.3.yaml"
152152
#elif (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,4,2,0)))
153153
"stack-8.4.2.yaml"
154-
#elif (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,2,2,0)))
155-
"stack-8.2.2.yaml"
156-
#elif __GLASGOW_HASKELL__ >= 802
157-
"stack-8.2.1.yaml"
158-
#else
159-
"stack-8.0.2.yaml"
160154
#endif
161155

162156
logFilePath :: String

0 commit comments

Comments
 (0)