WIP fix tests

It works, but tests are not up to date
This commit is contained in:
Avi Dessauer 2020-05-19 21:12:04 -04:00
parent 8266462b5f
commit 6a07072307
3 changed files with 45 additions and 29 deletions

View File

@ -17,7 +17,9 @@ spec = do
describe "Should Succeed"
$ it "successfully parses executable section"
$ exeSection ~> parseExe 0
`shouldParse` [Comp Exe "implicit-hie-exe" "app/Main.hs"]
`shouldParse` [ Comp Exe "implicit-hie-exe" "app/Main.hs",
Comp Exe "implicit-hie-exe" "app/Paths_implicit_hie.hs"
]
describe "Should Succeed"
$ it "successfully parses test section"
$ testSection ~> parseTestSuite 0
@ -42,13 +44,16 @@ spec = do
`shouldParse` [Comp Bench "folds" "benchmarks/folds.hs"]
describe "Should Succeed"
$ it "successfully parses package"
$ fullFile ~> parsePackage
`shouldParse` Package
"implicit-hie"
[ Comp Lib "" "src",
Comp Exe "implicit-hie-exe" "app/Main.hs",
Comp Test "implicit-hie-test" "test"
]
$ do
cf <- T.readFile "implicit-hie.cabal"
cf ~> parsePackage
`shouldParse` Package
"implicit-hie"
[ Comp Lib "" "src",
Comp Exe "implicit-hie-exe" "app/Main.hs",
Comp Exe "implicit-hie-exe" "app/Paths_implicit_hie.hs",
Comp Test "implicit-hie-test" "test"
]
describe "Should Succeed"
$ it
"skips to end of block section"
@ -57,10 +62,13 @@ spec = do
`leavesUnconsumed` r
describe "Should Succeed"
$ it "successfully generates stack hie.yaml"
$ (hieYaml "stack" . fmtPkgs "stack" . (: []) <$> parseOnly parsePackage fullFile)
`shouldBe` Right stackHie
$ do
sf <- readFile "test/stackHie.yaml"
cf <- T.readFile "implicit-hie.cabal"
(hieYaml "stack" . fmtPkgs "stack" . (: []) <$> parseOnly parsePackage cf)
`shouldBe` Right sf
describe "Should Succeed"
$ it "successfully generates stack hie.yaml"
$ it "successfully generates cabal hie.yaml for haskell-language-server"
$ do
f <- T.readFile "test/haskell-language-server-cabal"
o <- readFile "test/hie.yaml.cbl"
@ -82,9 +90,6 @@ spec = do
$ ("\"one\"\n two\n three3" :: Text) ~> parseList 1
`shouldParse` ["one", "two", "three3"]
fullFile :: Text
fullFile = "name: implicit-hie\n" <> libSection <> exeSection <> testSection
exeSection :: Text
exeSection =
"executable implicit-hie-exe\n\
@ -167,17 +172,3 @@ libSection3 =
\ , text\n\
\ default-language: Haskell2010\n\
\"
stackHie :: String
stackHie =
"cradle:\n\
\ stack:\n\
\ - path: \"src\"\n\
\ component: \"implicit-hie:lib\"\n\
\\n\
\ - path: \"app/Main.hs\"\n\
\ component: \"implicit-hie:exe:implicit-hie-exe\"\n\
\\n\
\ - path: \"test\"\n\
\ component: \"implicit-hie:test:implicit-hie-test\"\n\
\"

View File

@ -6,11 +6,23 @@ cradle:
- path: "exe/Main.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "exe/Arguments.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "exe/Paths_haskell_language_server.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "exe/Wrapper.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"
- path: "exe/Arguments.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"
- path: "exe/Paths_haskell_language_server.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"
- path: "test/functional"
component: "haskell-language-server:test:func-test"
- path: "test/utils"
component: "lib:haskell-language-server:hls-test-utils"
component: "haskell-language-server:lib:hls-test-utils"

13
test/stackHie.yaml Normal file
View File

@ -0,0 +1,13 @@
cradle:
stack:
- path: "./src"
component: "implicit-hie:lib"
- path: "./app/Main.hs"
component: "implicit-hie:exe:gen-hie"
- path: "./app/Paths_implicit_hie.hs"
component: "implicit-hie:exe:gen-hie"
- path: "./test"
component: "implicit-hie:test:implicit-hie-test"