Skip to content

Commit 6a07072

Browse files
committed
WIP fix tests
It works, but tests are not up to date
1 parent 8266462 commit 6a07072

File tree

3 files changed

+45
-29
lines changed

3 files changed

+45
-29
lines changed

test/Spec.hs

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ spec = do
1717
describe "Should Succeed"
1818
$ it "successfully parses executable section"
1919
$ exeSection ~> parseExe 0
20-
`shouldParse` [Comp Exe "implicit-hie-exe" "app/Main.hs"]
20+
`shouldParse` [ Comp Exe "implicit-hie-exe" "app/Main.hs",
21+
Comp Exe "implicit-hie-exe" "app/Paths_implicit_hie.hs"
22+
]
2123
describe "Should Succeed"
2224
$ it "successfully parses test section"
2325
$ testSection ~> parseTestSuite 0
@@ -42,13 +44,16 @@ spec = do
4244
`shouldParse` [Comp Bench "folds" "benchmarks/folds.hs"]
4345
describe "Should Succeed"
4446
$ it "successfully parses package"
45-
$ fullFile ~> parsePackage
46-
`shouldParse` Package
47-
"implicit-hie"
48-
[ Comp Lib "" "src",
49-
Comp Exe "implicit-hie-exe" "app/Main.hs",
50-
Comp Test "implicit-hie-test" "test"
51-
]
47+
$ do
48+
cf <- T.readFile "implicit-hie.cabal"
49+
cf ~> parsePackage
50+
`shouldParse` Package
51+
"implicit-hie"
52+
[ Comp Lib "" "src",
53+
Comp Exe "implicit-hie-exe" "app/Main.hs",
54+
Comp Exe "implicit-hie-exe" "app/Paths_implicit_hie.hs",
55+
Comp Test "implicit-hie-test" "test"
56+
]
5257
describe "Should Succeed"
5358
$ it
5459
"skips to end of block section"
@@ -57,10 +62,13 @@ spec = do
5762
`leavesUnconsumed` r
5863
describe "Should Succeed"
5964
$ it "successfully generates stack hie.yaml"
60-
$ (hieYaml "stack" . fmtPkgs "stack" . (: []) <$> parseOnly parsePackage fullFile)
61-
`shouldBe` Right stackHie
65+
$ do
66+
sf <- readFile "test/stackHie.yaml"
67+
cf <- T.readFile "implicit-hie.cabal"
68+
(hieYaml "stack" . fmtPkgs "stack" . (: []) <$> parseOnly parsePackage cf)
69+
`shouldBe` Right sf
6270
describe "Should Succeed"
63-
$ it "successfully generates stack hie.yaml"
71+
$ it "successfully generates cabal hie.yaml for haskell-language-server"
6472
$ do
6573
f <- T.readFile "test/haskell-language-server-cabal"
6674
o <- readFile "test/hie.yaml.cbl"
@@ -82,9 +90,6 @@ spec = do
8290
$ ("\"one\"\n two\n three3" :: Text) ~> parseList 1
8391
`shouldParse` ["one", "two", "three3"]
8492

85-
fullFile :: Text
86-
fullFile = "name: implicit-hie\n" <> libSection <> exeSection <> testSection
87-
8893
exeSection :: Text
8994
exeSection =
9095
"executable implicit-hie-exe\n\
@@ -167,17 +172,3 @@ libSection3 =
167172
\ , text\n\
168173
\ default-language: Haskell2010\n\
169174
\"
170-
171-
stackHie :: String
172-
stackHie =
173-
"cradle:\n\
174-
\ stack:\n\
175-
\ - path: \"src\"\n\
176-
\ component: \"implicit-hie:lib\"\n\
177-
\\n\
178-
\ - path: \"app/Main.hs\"\n\
179-
\ component: \"implicit-hie:exe:implicit-hie-exe\"\n\
180-
\\n\
181-
\ - path: \"test\"\n\
182-
\ component: \"implicit-hie:test:implicit-hie-test\"\n\
183-
\"

test/hie.yaml.cbl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,23 @@ cradle:
66
- path: "exe/Main.hs"
77
component: "haskell-language-server:exe:haskell-language-server"
88

9+
- path: "exe/Arguments.hs"
10+
component: "haskell-language-server:exe:haskell-language-server"
11+
12+
- path: "exe/Paths_haskell_language_server.hs"
13+
component: "haskell-language-server:exe:haskell-language-server"
14+
915
- path: "exe/Wrapper.hs"
1016
component: "haskell-language-server:exe:haskell-language-server-wrapper"
1117

18+
- path: "exe/Arguments.hs"
19+
component: "haskell-language-server:exe:haskell-language-server-wrapper"
20+
21+
- path: "exe/Paths_haskell_language_server.hs"
22+
component: "haskell-language-server:exe:haskell-language-server-wrapper"
23+
1224
- path: "test/functional"
1325
component: "haskell-language-server:test:func-test"
1426

1527
- path: "test/utils"
16-
component: "lib:haskell-language-server:hls-test-utils"
28+
component: "haskell-language-server:lib:hls-test-utils"

test/stackHie.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cradle:
2+
stack:
3+
- path: "./src"
4+
component: "implicit-hie:lib"
5+
6+
- path: "./app/Main.hs"
7+
component: "implicit-hie:exe:gen-hie"
8+
9+
- path: "./app/Paths_implicit_hie.hs"
10+
component: "implicit-hie:exe:gen-hie"
11+
12+
- path: "./test"
13+
component: "implicit-hie:test:implicit-hie-test"

0 commit comments

Comments
 (0)