Skip to content

Commit ccb5943

Browse files
committed
Replace neat-interpolation with string-interpolate
haskell#4626 (comment)
1 parent bd58606 commit ccb5943

File tree

6 files changed

+100
-100
lines changed

6 files changed

+100
-100
lines changed

hls-test-utils/hls-test-utils.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ library
4949
, lsp
5050
, lsp-test ^>=0.17
5151
, lsp-types ^>=2.3
52-
, neat-interpolation
5352
, safe-exceptions
53+
, string-interpolate
5454
, tasty
5555
, tasty-expected-failure
5656
, tasty-golden

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ goldenWithDocInTmpDir languageKind config plugin title tree path desc ext act =
357357
-- For example:
358358
--
359359
-- @
360-
-- parameterisedCursorTest "Cursor Test" [trimming|
360+
-- parameterisedCursorTest "Cursor Test" [__i|
361361
-- foo = 2
362362
-- ^
363363
-- bar = 3
@@ -380,7 +380,7 @@ goldenWithDocInTmpDir languageKind config plugin title tree path desc ext act =
380380
-- TODO: Many Haskell and Cabal source may contain '^' characters for good reasons.
381381
-- We likely need a way to change the character for certain test cases in the future.
382382
--
383-
-- The quasi quoter 'trimming' is very helpful to define such tests, as it additionally
383+
-- The quasi quoter '__i' is very helpful to define such tests, as it additionally
384384
-- allows to interpolate haskell values and functions. We reexport this quasi quoter
385385
-- for easier usage.
386386
parameterisedCursorTest :: (Show a, Eq a) => String -> T.Text -> [a] -> (T.Text -> PosPrefixInfo -> IO a) -> TestTree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module Test.Hls.Util
4747
-- * Extract positions from input file.
4848
, extractCursorPositions
4949
, mkParameterisedLabel
50-
, trimming
50+
, __i
5151
)
5252
where
5353

@@ -81,11 +81,11 @@ import Test.Tasty.ExpectedFailure (expectFailBecause,
8181
import Test.Tasty.HUnit (assertFailure)
8282

8383
import qualified Data.List as List
84+
import Data.String.Interpolate (__i)
8485
import qualified Data.Text.Internal.Search as T
8586
import qualified Data.Text.Utf16.Rope.Mixed as Rope
8687
import Development.IDE.Plugin.Completions.Logic (getCompletionPrefixFromRope)
8788
import Development.IDE.Plugin.Completions.Types (PosPrefixInfo (..))
88-
import NeatInterpolation (trimming)
8989

9090
noLiteralCaps :: ClientCapabilities
9191
noLiteralCaps = def & L.textDocument ?~ textDocumentCaps

plugins/hls-cabal-plugin/test/Completer.hs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -392,39 +392,39 @@ extract item = case item ^. L.textEdit of
392392
_ -> error ""
393393

394394
importTestData :: T.Text
395-
importTestData = [trimming|
396-
cabal-version: 3.0
397-
name: hls-cabal-plugin
398-
version: 0.1.0.0
399-
synopsis:
400-
homepage:
401-
license: MIT
402-
license-file: LICENSE
403-
author: Fendor
404-
maintainer: [email protected]
405-
category: Development
406-
extra-source-files: CHANGELOG.md
395+
importTestData = [__i|
396+
cabal-version: 3.0
397+
name: hls-cabal-plugin
398+
version: 0.1.0.0
399+
synopsis:
400+
homepage:
401+
license: MIT
402+
license-file: LICENSE
403+
author: Fendor
404+
maintainer: [email protected]
405+
category: Development
406+
extra-source-files: CHANGELOG.md
407407

408-
common defaults
409-
default-language: GHC2021
410-
-- Should have been in GHC2021, an oversight
411-
default-extensions: ExplicitNamespaces
408+
common defaults
409+
default-language: GHC2021
410+
-- Should have been in GHC2021, an oversight
411+
default-extensions: ExplicitNamespaces
412412

413-
common test-defaults
414-
ghc-options: -threaded -rtsopts -with-rtsopts=-N
413+
common test-defaults
414+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
415415

416-
library
417-
import:
418-
^
419-
exposed-modules: IDE.Plugin.Cabal
420-
build-depends: base ^>=4.14.3.0
421-
hs-source-dirs: src
422-
default-language: Haskell2010
416+
library
417+
import:
418+
^
419+
exposed-modules: IDE.Plugin.Cabal
420+
build-depends: base ^>=4.14.3.0
421+
hs-source-dirs: src
422+
default-language: Haskell2010
423423

424-
common notForLib
425-
default-language: GHC2021
424+
common notForLib
425+
default-language: GHC2021
426426

427-
test-suite tests
428-
import:
429-
^
427+
test-suite tests
428+
import:
429+
^
430430
|]

plugins/hls-cabal-plugin/test/Context.hs

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -217,93 +217,93 @@ getContextTests =
217217
-- ------------------------------------------------------------------------
218218

219219
libraryStanzaData :: T.Text
220-
libraryStanzaData = [trimming|
221-
cabal-version: 3.0
222-
name: simple-cabal
223-
library
224-
default-language: Haskell98
225-
build-depends:
220+
libraryStanzaData = [__i|
221+
cabal-version: 3.0
222+
name: simple-cabal
223+
library
224+
default-language: Haskell98
225+
build-depends:
226226

227-
ma
227+
ma
228228
|]
229229

230230
executableStanzaData :: T.Text
231-
executableStanzaData = [trimming|
232-
cabal-version: 3.0
233-
name: simple-cabal
234-
executable exeName
235-
default-language: Haskell2010
236-
hs-source-dirs: test/preprocessor
231+
executableStanzaData = [__i|
232+
cabal-version: 3.0
233+
name: simple-cabal
234+
executable exeName
235+
default-language: Haskell2010
236+
hs-source-dirs: test/preprocessor
237237
|]
238238

239239
topLevelData :: T.Text
240-
topLevelData = [trimming|
241-
cabal-version: 3.0
242-
name:
240+
topLevelData = [__i|
241+
cabal-version: 3.0
242+
name:
243243

244244

245245

246-
eee
246+
eee
247247
|]
248248

249249
conditionalData :: T.Text
250-
conditionalData = [trimming|
251-
cabal-version: 3.0
252-
name: simple-cabal
253-
library
254-
if os(windows)
255-
buildable:
256-
elif os(linux)
257-
buildable:
258-
else
259-
buildable:
250+
conditionalData = [__i|
251+
cabal-version: 3.0
252+
name: simple-cabal
253+
library
254+
if os(windows)
255+
buildable:
256+
elif os(linux)
257+
buildable:
258+
else
259+
buildable:
260260
|]
261261
multiLineOptsData :: T.Text
262-
multiLineOptsData = [trimming|
263-
cabal-version: 3.0
264-
name:
262+
multiLineOptsData = [__i|
263+
cabal-version: 3.0
264+
name:
265265

266266

267-
library
268-
build-depends:
269-
base,
267+
library
268+
build-depends:
269+
base,
270270

271-
text ,
271+
text ,
272272
|]
273273

274274
multiPositionTestData :: T.Text
275-
multiPositionTestData = [trimming|
276-
cabal-version: 3.4
277-
^ ^
278-
category: Development
279-
^
280-
name: haskell-language-server
281-
description:
282-
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
275+
multiPositionTestData = [__i|
276+
cabal-version: 3.4
277+
^ ^
278+
category: Development
283279
^
284-
extra-source-files:
285-
README.md
286-
ChangeLog.md
287-
test/testdata/**/*.project
288-
test/testdata/**/*.cabal
289-
test/testdata/**/*.yaml
290-
test/testdata/**/*.hs
291-
test/testdata/**/*.json
292-
^
293-
-- These globs should only match test/testdata
294-
plugins/**/*.project
280+
name: haskell-language-server
281+
description:
282+
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server\#readme>
283+
^
284+
extra-source-files:
285+
README.md
286+
ChangeLog.md
287+
test/testdata/**/*.project
288+
test/testdata/**/*.cabal
289+
test/testdata/**/*.yaml
290+
test/testdata/**/*.hs
291+
test/testdata/**/*.json
292+
^
293+
-- These globs should only match test/testdata
294+
plugins/**/*.project
295295

296-
source-repository head
297-
^ ^ ^
298-
type: git
299-
^ ^ ^ ^
300-
location: https://github.com/haskell/haskell-language-server
296+
source-repository head
297+
^ ^ ^
298+
type: git
299+
^ ^ ^ ^
300+
location: https://github.com/haskell/haskell-language-server
301301

302-
^
303-
common cabalfmt
302+
^
303+
common cabalfmt
304304

305-
^
306-
build-depends: haskell-language-server:hls-cabal-fmt-plugin
307-
^ ^
308-
cpp-options: -Dhls_cabalfmt
305+
^
306+
build-depends: haskell-language-server:hls-cabal-fmt-plugin
307+
^ ^
308+
cpp-options: -Dhls_cabalfmt
309309
|]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ reloadOnCabalChangeTests = testGroup "Reload on .cabal changes"
292292
cabalDoc <- openDoc "simple-reload.cabal" "cabal"
293293
skipManyTill anyMessage cabalKickDone
294294
saveDoc cabalDoc
295-
[trimming|
295+
[__i|
296296
cabal-version: 3.4
297297
name: simple-reload
298298
version: 0.1.0.0

0 commit comments

Comments
 (0)