Skip to content

Issue 5 - Move HIE Tests and convert to Tasty #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a2a2306
Initial Structure
jeffwindsor May 4, 2020
56363dd
Incorporate hls-test-utils
jeffwindsor May 9, 2020
4ec1817
Move to functional folder with first real test
jeffwindsor May 9, 2020
d1ab2d8
Commands (de-prefix failing)
jeffwindsor May 9, 2020
7c4f670
full test data
jeffwindsor May 9, 2020
86017da
add Completion Tests (all are timing out as of now)
jeffwindsor May 9, 2020
7ba6cc9
add Deferred Tests (2 out 4 failing)
jeffwindsor May 9, 2020
f3c5b87
Refactor Test Util and remove spec files
jeffwindsor May 10, 2020
c0d7dd1
add definition tests
jeffwindsor May 10, 2020
2949754
add diagnostic tests
jeffwindsor May 10, 2020
7b6c550
add format tests
jeffwindsor May 10, 2020
ece0d31
add FunctionalCodeAction tests
jeffwindsor May 10, 2020
f08db9b
add FunctionalLiquid HieBois Highlist tests
jeffwindsor May 10, 2020
f9173b0
add other tests
jeffwindsor May 10, 2020
8cccd93
turn on all tests
jeffwindsor May 10, 2020
d0c0e61
move and restore full test util module
jeffwindsor May 10, 2020
218ac49
add warmup, missing runner
jeffwindsor May 10, 2020
3274928
merge upstream master
jeffwindsor May 10, 2020
7c3d784
use hspec-expectations for shoulds
jeffwindsor May 11, 2020
fc140e5
add tasty-rerun
jeffwindsor May 11, 2020
ab41c8e
Merge branch 'master' into issue-5
jeffwindsor May 16, 2020
f23d9e4
remove old tasty util reference
jeffwindsor May 16, 2020
ade13db
rename Test.HIE.Util to Test.Hls.Util
jeffwindsor May 16, 2020
b16623e
fix ResponseMessage change
jeffwindsor May 17, 2020
2f55523
fix tests do not compile after update
jeffwindsor May 17, 2020
182b539
remove cabal-helper depends
jeffwindsor May 17, 2020
092db6e
ignore broken tests
jeffwindsor May 17, 2020
0c1708f
add xml output to runner
jeffwindsor May 17, 2020
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
106 changes: 49 additions & 57 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -205,69 +205,59 @@ executable haskell-language-server-wrapper
, process
default-language: Haskell2010


test-suite func-test
import: agpl
type: exitcode-stdio-1.0
default-language: Haskell2010
build-tool-depends: hspec-discover:hspec-discover
, haskell-language-server:haskell-language-server
, cabal-helper:cabal-helper-main
, ghcide:ghcide-test-preprocessor

build-depends:
base >=4.7 && <5
, aeson
, data-default
, haskell-lsp-types == 0.22.*
, hls-test-utils
, hspec
, lens
, lsp-test >= 0.10.0.0
, text
, unordered-containers
other-modules:
-- CompletionSpec
-- , CommandSpec
-- , DeferredSpec
-- , DefinitionSpec
-- , DiagnosticsSpec
FormatSpec
-- , FunctionalBadProjectSpec
-- , FunctionalCodeActionsSpec
-- , FunctionalLiquidSpec
, FunctionalSpec
-- , HaReSpec
-- , HieBiosSpec
-- , HighlightSpec
-- , HoverSpec
, PluginSpec
-- , ProgressSpec
-- , ReferencesSpec
-- , RenameSpec
-- , SymbolsSpec
-- , TypeDefinitionSpec
, Utils
, Paths_haskell_language_server

hs-source-dirs:
test/functional
ghc-options:
-Wall
-Wredundant-constraints
-Wno-name-shadowing
-threaded -rtsopts -with-rtsopts=-N
import: agpl
type: exitcode-stdio-1.0
default-language: Haskell2010
build-tool-depends: haskell-language-server:haskell-language-server
, ghcide:ghcide-test-preprocessor
build-depends: base >=4.7 && <5
, aeson
, data-default
, directory
, filepath
, haskell-language-server
, haskell-lsp
, haskell-lsp-types
, hls-test-utils
, hspec-expectations
, lens
, lsp-test >= 0.10.0.0
, tasty
, tasty-ant-xml
, tasty-expected-failure
, tasty-hunit
, tasty-rerun
, text
, unordered-containers
hs-source-dirs: test/functional
main-is: Main.hs
other-modules: Command
, Completion
, Deferred
, Definition
, Diagnostic
, Format
, FunctionalBadProject
, FunctionalCodeAction
, FunctionalLiquid
, HieBios
, Highlight
, Progress
, Reference
, Rename
, Symbol
, TypeDefinition
ghc-options: -Wall
-Wno-name-shadowing
-threaded -rtsopts -with-rtsopts=-N
if flag(pedantic)
ghc-options: -Werror
main-is: Main.hs
-- other-modules:
-- Development.IDE.Test
-- Development.IDE.Test.Runfiles
ghc-options: -Werror -Wredundant-constraints

library hls-test-utils
import: agpl
hs-source-dirs: test/utils
exposed-modules: TestUtils
exposed-modules: Test.Hls.Util
build-depends: base
, haskell-language-server
, haskell-lsp
Expand All @@ -281,7 +271,9 @@ library hls-test-utils
, hslogger
, hspec
, hspec-core
, lsp-test
, stm
, tasty-hunit
, text
, unordered-containers
, yaml
Expand Down
3 changes: 3 additions & 0 deletions hie.yaml.stack
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ cradle:
- path: "./test/functional/"
component: "haskell-language-server:func-test"

- path: "./test/src/"
component: "haskell-language-server:tasty"

# This target does not currently work (stack 2.1.3)
# - path: "./test/utils"
# component: "haskell-language-server:lib:hls-test-utils"
Expand Down
38 changes: 38 additions & 0 deletions test/functional/Command.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{-# LANGUAGE OverloadedStrings #-}
module Command (tests) where

import Control.Lens hiding (List)
import Control.Monad.IO.Class
import qualified Data.Text as T
import Data.Char
import Language.Haskell.LSP.Test
import Language.Haskell.LSP.Types as LSP
import Language.Haskell.LSP.Types.Lens as LSP
import Test.Hls.Util
import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.ExpectedFailure (ignoreTestBecause)
import Test.Hspec.Expectations


--TODO : Response Message no longer has 4 inputs
tests :: TestTree
tests = testGroup "commands" [
testCase "are prefixed" $
runSession hieCommand fullCaps "test/testdata/" $ do
ResponseMessage _ _ (Right res) <- initializeResponse
let List cmds = res ^. LSP.capabilities . executeCommandProvider . _Just . commands
f x = (T.length (T.takeWhile isNumber x) >= 1) && (T.count ":" x >= 2)
liftIO $ do
cmds `shouldSatisfy` all f
cmds `shouldNotSatisfy` null
, ignoreTestBecause "Broken: Plugin package doesn't exist" $
testCase "get de-prefixed" $
runSession hieCommand fullCaps "test/testdata/" $ do
ResponseMessage _ _ (Left err) <- request
WorkspaceExecuteCommand
(ExecuteCommandParams "1234:package:add" (Just (List [])) Nothing) :: Session ExecuteCommandResponse
let ResponseError _ msg _ = err
-- We expect an error message about the dud arguments, but should pickup "add" and "package"
liftIO $ msg `shouldSatisfy` T.isInfixOf "while parsing args for add in plugin package"
]
Loading