|
4 | 4 | module THTests (tests) where |
5 | 5 |
|
6 | 6 | import Control.Monad.IO.Class (liftIO) |
| 7 | +import Data.List.Extra (dropEnd, dropEnd1) |
7 | 8 | import Data.Row |
8 | 9 | import qualified Data.Text as T |
9 | 10 | import Development.IDE.GHC.Util |
@@ -141,7 +142,7 @@ thReloadingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do |
141 | 142 | expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding")])] |
142 | 143 |
|
143 | 144 | -- Change th from () to Bool |
144 | | - let aSource' = T.unlines $ init (T.lines aSource) ++ ["th_a = [d| a = False|]"] |
| 145 | + let aSource' = T.unlines $ dropEnd1 (T.lines aSource) ++ ["th_a = [d| a = False|]"] |
145 | 146 | changeDoc adoc [TextDocumentContentChangeEvent . InR . (.==) #text $ aSource'] |
146 | 147 | -- generate an artificial warning to avoid timing out if the TH change does not propagate |
147 | 148 | changeDoc cdoc [TextDocumentContentChangeEvent . InR . (.==) #text $ cSource <> "\nfoo=()"] |
@@ -175,11 +176,11 @@ thLinkingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do |
175 | 176 |
|
176 | 177 | expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding")])] |
177 | 178 |
|
178 | | - let aSource' = T.unlines $ init (init (T.lines aSource)) ++ ["th :: DecsQ", "th = [d| a = False|]"] |
| 179 | + let aSource' = T.unlines $ dropEnd 2 (T.lines aSource) ++ ["th :: DecsQ", "th = [d| a = False|]"] |
179 | 180 | changeDoc adoc [TextDocumentContentChangeEvent . InR . (.==) #text $ aSource'] |
180 | 181 |
|
181 | 182 | -- modify b too |
182 | | - let bSource' = T.unlines $ init (T.lines bSource) ++ ["$th"] |
| 183 | + let bSource' = T.unlines $ dropEnd1 (T.lines bSource) ++ ["$th"] |
183 | 184 | changeDoc bdoc [TextDocumentContentChangeEvent . InR . (.==) #text $ bSource'] |
184 | 185 | waitForProgressBegin |
185 | 186 | waitForAllProgressDone |
|
0 commit comments