Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hls-test-utils/hls-test-utils.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ library
, lsp
, lsp-test ^>=0.17
, lsp-types ^>=2.3
, neat-interpolation
, safe-exceptions
, string-interpolate
, tasty
, tasty-expected-failure
, tasty-golden
Expand Down
4 changes: 2 additions & 2 deletions hls-test-utils/src/Test/Hls.hs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ goldenWithDocInTmpDir languageKind config plugin title tree path desc ext act =
-- For example:
--
-- @
-- parameterisedCursorTest "Cursor Test" [trimming|
-- parameterisedCursorTest "Cursor Test" [__i|
-- foo = 2
-- ^
-- bar = 3
Expand All @@ -380,7 +380,7 @@ goldenWithDocInTmpDir languageKind config plugin title tree path desc ext act =
-- TODO: Many Haskell and Cabal source may contain '^' characters for good reasons.
-- We likely need a way to change the character for certain test cases in the future.
--
-- The quasi quoter 'trimming' is very helpful to define such tests, as it additionally
-- The quasi quoter '__i' is very helpful to define such tests, as it additionally
-- allows to interpolate haskell values and functions. We reexport this quasi quoter
-- for easier usage.
parameterisedCursorTest :: (Show a, Eq a) => String -> T.Text -> [a] -> (T.Text -> PosPrefixInfo -> IO a) -> TestTree
Expand Down
4 changes: 2 additions & 2 deletions hls-test-utils/src/Test/Hls/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module Test.Hls.Util
-- * Extract positions from input file.
, extractCursorPositions
, mkParameterisedLabel
, trimming
, __i
)
where

Expand Down Expand Up @@ -81,11 +81,11 @@ import Test.Tasty.ExpectedFailure (expectFailBecause,
import Test.Tasty.HUnit (assertFailure)

import qualified Data.List as List
import Data.String.Interpolate (__i)
import qualified Data.Text.Internal.Search as T
import qualified Data.Text.Utf16.Rope.Mixed as Rope
import Development.IDE.Plugin.Completions.Logic (getCompletionPrefixFromRope)
import Development.IDE.Plugin.Completions.Types (PosPrefixInfo (..))
import NeatInterpolation (trimming)

noLiteralCaps :: ClientCapabilities
noLiteralCaps = def & L.textDocument ?~ textDocumentCaps
Expand Down
60 changes: 30 additions & 30 deletions plugins/hls-cabal-plugin/test/Completer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -392,39 +392,39 @@ extract item = case item ^. L.textEdit of
_ -> error ""

importTestData :: T.Text
importTestData = [trimming|
cabal-version: 3.0
name: hls-cabal-plugin
version: 0.1.0.0
synopsis:
homepage:
license: MIT
license-file: LICENSE
author: Fendor
maintainer: [email protected]
category: Development
extra-source-files: CHANGELOG.md
importTestData = [__i|
cabal-version: 3.0
name: hls-cabal-plugin
version: 0.1.0.0
synopsis:
homepage:
license: MIT
license-file: LICENSE
author: Fendor
maintainer: [email protected]
category: Development
extra-source-files: CHANGELOG.md

common defaults
default-language: GHC2021
-- Should have been in GHC2021, an oversight
default-extensions: ExplicitNamespaces
common defaults
default-language: GHC2021
-- Should have been in GHC2021, an oversight
default-extensions: ExplicitNamespaces

common test-defaults
ghc-options: -threaded -rtsopts -with-rtsopts=-N
common test-defaults
ghc-options: -threaded -rtsopts -with-rtsopts=-N

library
import:
^
exposed-modules: IDE.Plugin.Cabal
build-depends: base ^>=4.14.3.0
hs-source-dirs: src
default-language: Haskell2010
library
import:
^
exposed-modules: IDE.Plugin.Cabal
build-depends: base ^>=4.14.3.0
hs-source-dirs: src
default-language: Haskell2010

common notForLib
default-language: GHC2021
common notForLib
default-language: GHC2021

test-suite tests
import:
^
test-suite tests
import:
^
|]
128 changes: 64 additions & 64 deletions plugins/hls-cabal-plugin/test/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -217,93 +217,93 @@ getContextTests =
-- ------------------------------------------------------------------------

libraryStanzaData :: T.Text
libraryStanzaData = [trimming|
cabal-version: 3.0
name: simple-cabal
library
default-language: Haskell98
build-depends:
libraryStanzaData = [__i|
cabal-version: 3.0
name: simple-cabal
library
default-language: Haskell98
build-depends:

ma
ma
|]

executableStanzaData :: T.Text
executableStanzaData = [trimming|
cabal-version: 3.0
name: simple-cabal
executable exeName
default-language: Haskell2010
hs-source-dirs: test/preprocessor
executableStanzaData = [__i|
cabal-version: 3.0
name: simple-cabal
executable exeName
default-language: Haskell2010
hs-source-dirs: test/preprocessor
|]

topLevelData :: T.Text
topLevelData = [trimming|
cabal-version: 3.0
name:
topLevelData = [__i|
cabal-version: 3.0
name:



eee
eee
|]

conditionalData :: T.Text
conditionalData = [trimming|
cabal-version: 3.0
name: simple-cabal
library
if os(windows)
buildable:
elif os(linux)
buildable:
else
buildable:
conditionalData = [__i|
cabal-version: 3.0
name: simple-cabal
library
if os(windows)
buildable:
elif os(linux)
buildable:
else
buildable:
|]
multiLineOptsData :: T.Text
multiLineOptsData = [trimming|
cabal-version: 3.0
name:
multiLineOptsData = [__i|
cabal-version: 3.0
name:


library
build-depends:
base,
library
build-depends:
base,

text ,
text ,
|]

multiPositionTestData :: T.Text
multiPositionTestData = [trimming|
cabal-version: 3.4
^ ^
category: Development
^
name: haskell-language-server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
multiPositionTestData = [__i|
cabal-version: 3.4
^ ^
category: Development
^
extra-source-files:
README.md
ChangeLog.md
test/testdata/**/*.project
test/testdata/**/*.cabal
test/testdata/**/*.yaml
test/testdata/**/*.hs
test/testdata/**/*.json
^
-- These globs should only match test/testdata
plugins/**/*.project
name: haskell-language-server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server\#readme>
^
extra-source-files:
README.md
ChangeLog.md
test/testdata/**/*.project
test/testdata/**/*.cabal
test/testdata/**/*.yaml
test/testdata/**/*.hs
test/testdata/**/*.json
^
-- These globs should only match test/testdata
plugins/**/*.project

source-repository head
^ ^ ^
type: git
^ ^ ^ ^
location: https://github.com/haskell/haskell-language-server
source-repository head
^ ^ ^
type: git
^ ^ ^ ^
location: https://github.com/haskell/haskell-language-server

^
common cabalfmt
^
common cabalfmt

^
build-depends: haskell-language-server:hls-cabal-fmt-plugin
^ ^
cpp-options: -Dhls_cabalfmt
^
build-depends: haskell-language-server:hls-cabal-fmt-plugin
^ ^
cpp-options: -Dhls_cabalfmt
|]
2 changes: 1 addition & 1 deletion plugins/hls-cabal-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ reloadOnCabalChangeTests = testGroup "Reload on .cabal changes"
cabalDoc <- openDoc "simple-reload.cabal" "cabal"
skipManyTill anyMessage cabalKickDone
saveDoc cabalDoc
[trimming|
[__i|
cabal-version: 3.4
name: simple-reload
version: 0.1.0.0
Expand Down
Loading