Skip to content

Commit fc2afb9

Browse files
committed
Revert test changes
1 parent 2220dd7 commit fc2afb9

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Diff for: .hlint.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
- Development.IDE.Plugin.CodeAction.ExactPrint
123123
- Development.IDE.Session
124124
- UnificationSpec
125+
- WatchedFileTests #Previously part of GHCIDE Main tests
125126

126127
- name: [Prelude.last, Data.List.last]
127128
within:
@@ -142,6 +143,9 @@
142143
- Ide.PluginUtils
143144
- Development.Benchmark.Rules
144145
- TErrorGivenPartialSignature
146+
- IfaceTests #Previously part of GHCIDE Main tests
147+
- THTests #Previously part of GHCIDE Main tests
148+
- WatchedFileTests #Previously part of GHCIDE Main tests
145149

146150
- name: Data.List.foldl1'
147151
within: []

Diff for: ghcide/test/exe/IfaceTests.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
module IfaceTests (tests) where
55

66
import Control.Monad.IO.Class (liftIO)
7-
import Data.List.Extra (dropEnd1)
87
import Data.Row
98
import qualified Data.Text as T
109
import Development.IDE.GHC.Util
@@ -50,7 +49,7 @@ ifaceTHTest = testCase "iface-th-test" $ runWithExtraFiles "TH" $ \dir -> do
5049
cdoc <- createDoc cPath "haskell" cSource
5150

5251
-- Change [TH]a from () to Bool
53-
liftIO $ writeFileUTF8 aPath (T.unpack $ T.unlines $ dropEnd1 (T.lines aSource) ++ ["th_a = [d| a = False|]"])
52+
liftIO $ writeFileUTF8 aPath (unlines $ init (lines $ T.unpack aSource) ++ ["th_a = [d| a = False|]"])
5453

5554
-- Check that the change propagates to C
5655
changeDoc cdoc [TextDocumentContentChangeEvent . InR . (.==) #text $ cSource]

Diff for: ghcide/test/exe/THTests.hs

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
module THTests (tests) where
55

66
import Control.Monad.IO.Class (liftIO)
7-
import Data.List.Extra (dropEnd, dropEnd1)
87
import Data.Row
98
import qualified Data.Text as T
109
import Development.IDE.GHC.Util
@@ -142,7 +141,7 @@ thReloadingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do
142141
expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding")])]
143142

144143
-- Change th from () to Bool
145-
let aSource' = T.unlines $ dropEnd1 (T.lines aSource) ++ ["th_a = [d| a = False|]"]
144+
let aSource' = T.unlines $ init (T.lines aSource) ++ ["th_a = [d| a = False|]"]
146145
changeDoc adoc [TextDocumentContentChangeEvent . InR . (.==) #text $ aSource']
147146
-- generate an artificial warning to avoid timing out if the TH change does not propagate
148147
changeDoc cdoc [TextDocumentContentChangeEvent . InR . (.==) #text $ cSource <> "\nfoo=()"]
@@ -176,11 +175,11 @@ thLinkingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do
176175

177176
expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding")])]
178177

179-
let aSource' = T.unlines $ dropEnd 2 (T.lines aSource) ++ ["th :: DecsQ", "th = [d| a = False|]"]
178+
let aSource' = T.unlines $ init (init (T.lines aSource)) ++ ["th :: DecsQ", "th = [d| a = False|]"]
180179
changeDoc adoc [TextDocumentContentChangeEvent . InR . (.==) #text $ aSource']
181180

182181
-- modify b too
183-
let bSource' = T.unlines $ dropEnd1 (T.lines bSource) ++ ["$th"]
182+
let bSource' = T.unlines $ init (T.lines bSource) ++ ["$th"]
184183
changeDoc bdoc [TextDocumentContentChangeEvent . InR . (.==) #text $ bSource']
185184
waitForProgressBegin
186185
waitForAllProgressDone

Diff for: ghcide/test/exe/WatchedFileTests.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module WatchedFileTests (tests) where
66
import Control.Applicative.Combinators
77
import Control.Monad.IO.Class (liftIO)
88
import qualified Data.Aeson as A
9-
import Data.List.Extra (drop1, dropEnd1)
109
import qualified Data.Text as T
1110
import Development.IDE.Test (expectDiagnostics)
1211
import Language.LSP.Protocol.Message
@@ -36,7 +35,7 @@ tests = testGroup "watched files"
3635

3736
, testSession' "non workspace file" $ \sessionDir -> do
3837
tmpDir <- liftIO getTemporaryDirectory
39-
let yaml = "cradle: {direct: {arguments: [\"-i" <> drop1 (dropEnd1 (show tmpDir)) <> "\", \"A\", \"WatchedFilesMissingModule\"]}}"
38+
let yaml = "cradle: {direct: {arguments: [\"-i" <> tail(init(show tmpDir)) <> "\", \"A\", \"WatchedFilesMissingModule\"]}}"
4039
liftIO $ writeFile (sessionDir </> "hie.yaml") yaml
4140
_doc <- createDoc "A.hs" "haskell" "{-# LANGUAGE NoImplicitPrelude#-}\nmodule A where\nimport WatchedFilesMissingModule"
4241
setIgnoringRegistrationRequests False

0 commit comments

Comments
 (0)