Skip to content

Commit 9c97238

Browse files
committed
Replace string interpolation lib in signature help tests
Newlines generated by neat-interpolation are sensitive[1] to platforms, which may make many tests of hls-cabal-plugin-tests fail on Windows. To keep this PR simple and focused, neat-interpolation usage outside of the signature help plugin is not changed. I plan to change that in a future PR. [1]: nikita-volkov/neat-interpolation#14
1 parent 5925c1c commit 9c97238

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

haskell-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ test-suite hls-signature-help-plugin-tests
882882
, hls-test-utils == 2.11.0.0
883883
, lens
884884
, lsp-types
885+
, string-interpolate
885886
, text
886887
default-extensions:
887888
DerivingStrategies

plugins/hls-signature-help-plugin/test/Main.hs

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import Control.Exception (throw)
44
import Control.Lens ((^.))
55
import Data.Maybe (fromJust)
6+
import Data.String.Interpolate (__i)
67
import Data.Text (Text)
78
import qualified Data.Text as T
89
import Development.IDE.Plugin.Completions.Types (PosPrefixInfo (PosPrefixInfo))
@@ -22,7 +23,7 @@ main =
2223
"signatureHelp"
2324
[ mkTest
2425
"1 parameter"
25-
[trimming|
26+
[__i|
2627
f :: Int -> Int
2728
f = _
2829
x = f 1
@@ -39,7 +40,7 @@ main =
3940
],
4041
mkTest
4142
"2 parameters"
42-
[trimming|
43+
[__i|
4344
f :: Int -> Int -> Int
4445
f = _
4546
x = f 1 2
@@ -52,7 +53,7 @@ main =
5253
],
5354
mkTest
5455
"3 parameters"
55-
[trimming|
56+
[__i|
5657
f :: Int -> Int -> Int -> Int
5758
f = _
5859
x = f 1 2 3
@@ -65,7 +66,7 @@ main =
6566
],
6667
mkTest
6768
"parentheses"
68-
[trimming|
69+
[__i|
6970
f :: Int -> Int -> Int
7071
f = _
7172
x = (f 1) 2
@@ -80,7 +81,7 @@ main =
8081
],
8182
mkTest
8283
"newline"
83-
[trimming|
84+
[__i|
8485
f :: Int -> Int -> Int
8586
f = _
8687
x =
@@ -106,7 +107,7 @@ main =
106107
],
107108
mkTest
108109
"nested"
109-
[trimming|
110+
[__i|
110111
f :: Int -> Int -> Int
111112
f = _
112113
g :: Int -> Int
@@ -125,7 +126,7 @@ main =
125126
],
126127
mkTest
127128
"higher-order function"
128-
[trimming|
129+
[__i|
129130
f :: (Int -> Int) -> Int -> Int
130131
f = _
131132
x = f (+ 1) 2
@@ -136,7 +137,7 @@ main =
136137
],
137138
mkTest
138139
"type constraint"
139-
[trimming|
140+
[__i|
140141
f :: (Num a) => a -> a -> a
141142
f = _
142143
x = f 1 2
@@ -148,7 +149,7 @@ main =
148149
],
149150
mkTest
150151
"type constraint with kind signatures"
151-
[trimming|
152+
[__i|
152153
x :: IO Bool
153154
x = pure True
154155
^ ^
@@ -158,7 +159,7 @@ main =
158159
],
159160
mkTest
160161
"2 type constraints"
161-
[trimming|
162+
[__i|
162163
f :: forall a. (Eq a, Num a) => a -> a -> a
163164
f = _
164165
x = f True
@@ -169,7 +170,7 @@ main =
169170
],
170171
mkTest
171172
"dynamic function"
172-
[trimming|
173+
[__i|
173174
f :: Int -> Int -> Int
174175
f = _
175176
g :: Int -> Int -> Int
@@ -180,7 +181,7 @@ main =
180181
(replicate 18 Nothing),
181182
mkTest
182183
"very long type"
183-
[trimming|
184+
[__i|
184185
f :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int
185186
f = _
186187
x = f 1
@@ -191,7 +192,7 @@ main =
191192
],
192193
mkTest
193194
"very long type with type constraint"
194-
[trimming|
195+
[__i|
195196
f :: Num abcdefghijklmn => abcdefghijklmn -> abcdefghijklmn -> abcdefghijklmn -> abcdefghijklmn -> abcdefghijklmn
196197
f = _
197198
x = f 1
@@ -202,7 +203,7 @@ main =
202203
],
203204
mkTest
204205
"middle =>"
205-
[trimming|
206+
[__i|
206207
f :: Eq a => a -> Num b => b -> b
207208
f = _
208209
x = f 1 True
@@ -220,7 +221,7 @@ main =
220221
],
221222
mkTest
222223
"=> in argument"
223-
[trimming|
224+
[__i|
224225
f :: Eq a => a -> (Num b => b -> b) -> a
225226
f = _
226227
x = f 1
@@ -241,7 +242,7 @@ main =
241242
),
242243
mkTest
243244
"RankNTypes(forall in middle)"
244-
[trimming|
245+
[__i|
245246
f :: Maybe a -> forall b. (a, b) -> b
246247
f = _
247248
x1 = f Nothing
@@ -258,7 +259,7 @@ main =
258259
],
259260
mkTest
260261
"RankNTypes(forall in middle), another"
261-
[trimming|
262+
[__i|
262263
f :: l -> forall a. a -> a
263264
f = _
264265
x = f 1
@@ -269,7 +270,7 @@ main =
269270
],
270271
mkTest
271272
"RankNTypes(forall in middle), again"
272-
[trimming|
273+
[__i|
273274
f :: a -> forall a. a -> a
274275
f = _
275276
x = f 1
@@ -280,8 +281,8 @@ main =
280281
],
281282
mkTest
282283
"LinearTypes"
283-
[trimming|
284-
{-# LANGUAGE LinearTypes #-}
284+
[__i|
285+
{-\# LANGUAGE LinearTypes \#-}
285286
f :: (a -> b) %1 -> a -> b
286287
f = _
287288
x1 = f negate
@@ -295,7 +296,7 @@ main =
295296
],
296297
mkTest
297298
"function documentation"
298-
[trimming|
299+
[__i|
299300
-- |The 'f' function does something to a bool value.
300301
f :: Bool -> Bool
301302
f = _
@@ -307,7 +308,7 @@ main =
307308
],
308309
mkTest
309310
"function and arguments documentation"
310-
[trimming|
311+
[__i|
311312
-- |Doc for function 'f'.
312313
f ::
313314
-- | The first 'Bool' argument
@@ -325,7 +326,7 @@ main =
325326
],
326327
mkTest
327328
"imported function with no documentation"
328-
[trimming|
329+
[__i|
329330
x = even 1
330331
^ ^
331332
|]
@@ -334,7 +335,7 @@ main =
334335
],
335336
mkTest
336337
"imported function with argument documentation"
337-
[trimming|
338+
[__i|
338339
import Language.Haskell.TH.Lib (mkBytes)
339340
x = mkBytes _
340341
^ ^
@@ -344,7 +345,7 @@ main =
344345
],
345346
mkTest
346347
"TypeApplications"
347-
[trimming|
348+
[__i|
348349
f :: a -> b -> c
349350
f = _
350351
x = f @Int @_ 1 True

0 commit comments

Comments
 (0)