Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 491eed2

Browse files
committed
Replace neat-interpolation with string-interpolate
Newlines generated by neat-interpolation are sensitive[1] to platforms, which may make many tests of hls-cabal-plugin-tests fail on Windows. [1]: nikita-volkov/neat-interpolation#14
1 parent 5925c1c commit 491eed2

File tree

6 files changed

+139
-132
lines changed

6 files changed

+139
-132
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: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -392,39 +392,40 @@ 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: fendor@posteo.de
405-
category: Development
406-
extra-source-files: CHANGELOG.md
395+
importTestData =
396+
[__i|
397+
cabal-version: 3.0
398+
name: hls-cabal-plugin
399+
version: 0.1.0.0
400+
synopsis:
401+
homepage:
402+
license: MIT
403+
license-file: LICENSE
404+
author: Fendor
405+
maintainer: fendor@posteo.de
406+
category: Development
407+
extra-source-files: CHANGELOG.md
407408

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

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

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
417+
library
418+
import:
419+
^
420+
exposed-modules: IDE.Plugin.Cabal
421+
build-depends: base ^>=4.14.3.0
422+
hs-source-dirs: src
423+
default-language: Haskell2010
423424

424-
common notForLib
425-
default-language: GHC2021
425+
common notForLib
426+
default-language: GHC2021
426427

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

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

Lines changed: 77 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -217,93 +217,99 @@ 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 =
221+
[__i|
222+
cabal-version: 3.0
223+
name: simple-cabal
224+
library
225+
default-language: Haskell98
226+
build-depends:
226227

227-
ma
228-
|]
228+
ma
229+
|]
229230

230231
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
237-
|]
232+
executableStanzaData =
233+
[__i|
234+
cabal-version: 3.0
235+
name: simple-cabal
236+
executable exeName
237+
default-language: Haskell2010
238+
hs-source-dirs: test/preprocessor
239+
|]
238240

239241
topLevelData :: T.Text
240-
topLevelData = [trimming|
241-
cabal-version: 3.0
242-
name:
242+
topLevelData =
243+
[__i|
244+
cabal-version: 3.0
245+
name:
243246

244247

245248

246-
eee
247-
|]
249+
eee
250+
|]
248251

249252
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:
260-
|]
253+
conditionalData =
254+
[__i|
255+
cabal-version: 3.0
256+
name: simple-cabal
257+
library
258+
if os(windows)
259+
buildable:
260+
elif os(linux)
261+
buildable:
262+
else
263+
buildable:
264+
|]
261265
multiLineOptsData :: T.Text
262-
multiLineOptsData = [trimming|
263-
cabal-version: 3.0
264-
name:
266+
multiLineOptsData =
267+
[__i|
268+
cabal-version: 3.0
269+
name:
265270

266271

267-
library
268-
build-depends:
269-
base,
272+
library
273+
build-depends:
274+
base,
270275

271-
text ,
272-
|]
276+
text ,
277+
|]
273278

274279
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>
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
280+
multiPositionTestData =
281+
[__i|
282+
cabal-version: 3.4
283+
^ ^
284+
category: Development
285+
^
286+
name: haskell-language-server
287+
description:
288+
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server\#readme>
289+
^
290+
extra-source-files:
291+
README.md
292+
ChangeLog.md
293+
test/testdata/**/*.project
294+
test/testdata/**/*.cabal
295+
test/testdata/**/*.yaml
296+
test/testdata/**/*.hs
297+
test/testdata/**/*.json
298+
^
299+
-- These globs should only match test/testdata
300+
plugins/**/*.project
295301

296-
source-repository head
297-
^ ^ ^
298-
type: git
299-
^ ^ ^ ^
300-
location: https://github.com/haskell/haskell-language-server
302+
source-repository head
303+
^ ^ ^
304+
type: git
305+
^ ^ ^ ^
306+
location: https://github.com/haskell/haskell-language-server
301307

302-
^
303-
common cabalfmt
308+
^
309+
common cabalfmt
304310

305-
^
306-
build-depends: haskell-language-server:hls-cabal-fmt-plugin
307-
^ ^
308-
cpp-options: -Dhls_cabalfmt
309-
|]
311+
^
312+
build-depends: haskell-language-server:hls-cabal-fmt-plugin
313+
^ ^
314+
cpp-options: -Dhls_cabalfmt
315+
|]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /