Skip to content

Commit 3621971

Browse files
committed
Fix/delete tests
1 parent 2752d7c commit 3621971

File tree

4 files changed

+22
-214
lines changed

4 files changed

+22
-214
lines changed

test/Spec.hs

Lines changed: 9 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -13,213 +13,32 @@ main = hspec spec
1313

1414
spec :: Spec
1515
spec = do
16-
describe "Should Succeed" $
17-
it "successfully parses executable section" $
18-
exeSection ~> parseExe 0
19-
`shouldParse` [Comp Exe "gen-hie" "app/Main.hs"]
20-
describe "Should Succeed" $
21-
it "successfully parses test section" $
22-
testSection ~> parseTestSuite 0
23-
`shouldParse` [Comp Test "implicit-hie-test" "test"]
24-
describe "Should Succeed" $
25-
it "successfully parses library section" $
26-
libSection ~> parseLib 0
27-
`shouldParse` [Comp Lib "" "src"]
28-
describe "Should Succeed" $
29-
it "successfully parses library section with 2 hs-source-dirs" $
30-
libSection2 ~> parseLib 0
31-
`shouldParse` [Comp Lib "" "src", Comp Lib "" "src2"]
32-
describe "Should Succeed" $
33-
it "successfully parses library section with 2 paths under hs-source-dirs" $
34-
libSection3 ~> parseLib 0
35-
`shouldParse` [Comp Lib "" "src", Comp Lib "" "src2"]
36-
describe "Should Succeed" $
37-
it "successfully parses bench section" $
38-
do
39-
bs <- T.readFile "test/benchSection"
40-
bs ~> parseBench 0
41-
`shouldParse` [Comp Bench "folds" "benchmarks/folds.hs"]
4216
describe "Should Succeed" $
4317
it "successfully parses package" $
4418
do
4519
cf <- T.readFile "implicit-hie.cabal"
46-
cf ~> parsePackage
20+
parsePackage' cf
4721
`shouldParse` Package
4822
"implicit-hie"
49-
[ Comp Lib "" "src",
23+
[ Comp Test "implicit-hie-test" "test/Spec.hs",
5024
Comp Exe "gen-hie" "app/Main.hs",
51-
Comp Test "implicit-hie-test" "test"
25+
Comp Lib "" "src/Hie/Cabal/Parser.hs",
26+
Comp Lib "" "src/Hie/Locate.hs",
27+
Comp Lib "" "src/Hie/Yaml.hs"
5228
]
53-
describe "Should Succeed" $
54-
it
55-
"skips to end of block section"
56-
$ let r = "test\n"
57-
in (libSection <> r) ~?> parseLib 0
58-
`leavesUnconsumed` r
29+
5930
describe "Should Succeed" $
6031
it "successfully generates stack hie.yaml" $
6132
do
6233
sf <- readFile "test/stackHie.yaml"
6334
cf <- T.readFile "implicit-hie.cabal"
64-
(hieYaml "stack" . fmtPkgs "stack" . (: []) <$> parseOnly parsePackage cf)
35+
(hieYaml "stack" . fmtPkgs "stack" . (: []) <$> parsePackage' cf)
6536
`shouldBe` Right sf
37+
6638
describe "Should Succeed" $
6739
it "successfully generates cabal hie.yaml for haskell-language-server" $
6840
do
6941
f <- T.readFile "test/haskell-language-server-cabal"
7042
o <- readFile "test/hie.yaml.cbl"
71-
(hieYaml "cabal" . fmtPkgs "cabal" . (: []) <$> parseOnly parsePackage f)
43+
(hieYaml "cabal" . fmtPkgs "cabal" . (: []) <$> parsePackage' f)
7244
`shouldBe` Right o
73-
describe "Should Succeed" $
74-
it "successfully parses comma list" $
75-
("one, two" :: Text) ~> parseList 1 `shouldParse` ["one", "two"]
76-
describe "Should Succeed" $
77-
it "successfully parses newline list" $
78-
("one\n two \n three3" :: Text) ~> parseList 1
79-
`shouldParse` ["one", "two", "three3"]
80-
describe "Should Succeed" $
81-
it "successfully parses newline comma list" $
82-
("one\n two, three3" :: Text) ~> parseList 1
83-
`shouldParse` ["one", "two", "three3"]
84-
describe "Should Succeed" $
85-
it "quoted list" $
86-
("\"one\"\n two\n three3" :: Text) ~> parseList 1
87-
`shouldParse` ["one", "two", "three3"]
88-
describe "Should Succeed" $
89-
it "list with leading commas" $
90-
("one\n , two\n , three3" :: Text) ~> parseList 1
91-
`shouldParse` ["one", "two", "three3"]
92-
describe "Should Succeed" $
93-
it "list with a comment" $
94-
("foo\n -- need to include this too\n bar\n" :: Text) ~> parseList 1
95-
`shouldParse` ["foo", "bar"]
96-
describe "Should Succeed" $
97-
it "list2 with a comment" $
98-
("foo -- need to include this too\n bar\n" :: Text) ~> parseList 1
99-
`shouldParse` ["foo", "bar"]
100-
describe "Should Succeed" $
101-
it "list3 with a comment" $
102-
("foo -- need to include this too\n bar" :: Text) ~> parseList 1
103-
`shouldParse` ["foo", "bar"]
104-
describe "Should Succeed" $
105-
it "list4 with a comment" $
106-
("foo\n bar\n -- need to include this too" :: Text) ~> parseList 1
107-
`shouldParse` ["foo", "bar"]
108-
describe "Should Succeed" $
109-
it "list5 with a comment" $
110-
("foo\n bar -- need to include this too" :: Text) ~> parseList 1
111-
`shouldParse` ["foo", "bar"]
112-
describe "Should Succeed" $
113-
it "succesfully parses exe component with other-modules containing dots" $
114-
exeSection2 ~> parseExe 0
115-
`shouldParse` [ Comp Exe "gen-hie" "app/Main.hs",
116-
Comp Exe "gen-hie" "app/Hie/Executable/Helper.hs",
117-
Comp Exe "gen-hie" "app/Hie/Executable/Utils.hs"
118-
]
119-
describe "Should Succeed" $
120-
it "succesfully parses single other-modules" $
121-
("other-modules: test\ndefault-language: Haskell2011" :: Text) ~?> field 0 "other-modules" parseList
122-
`leavesUnconsumed` "default-language: Haskell2011"
123-
describe "Should Succeed" $
124-
it "succesfully parses empty other-modules1" $
125-
("other-modules: test\ndefault-language: Haskell2011" :: Text) ~?> field 0 "other-modules" parseList
126-
`leavesUnconsumed` "default-language: Haskell2011"
127-
describe "Should Succeed" $
128-
it "succesfully parses empty other-modules2" $
129-
(" other-modules: \n build-depends:\n base >=4.9 && <5" :: Text) ~> field 0 "other-modules" parseList
130-
`shouldParse` []
131-
132-
exeSection :: Text
133-
exeSection =
134-
"executable gen-hie\n\
135-
\ other-modules:\n\
136-
\ Paths_implicit_hie\n\
137-
\ autogen-modules:\n\
138-
\ Paths_implicit_hie\n\
139-
\ hs-source-dirs:\n\
140-
\ app\n\
141-
\ ghc-options: -O2\n\
142-
\ main-is: Main.hs \n"
143-
144-
testSection :: Text
145-
testSection =
146-
"test-suite implicit-hie-test\n\
147-
\ type: exitcode-stdio-1.0\n\
148-
\ other-modules:\n\
149-
\ Paths_implicit_hie\n\
150-
\ hs-source-dirs:\n\
151-
\ test\n\
152-
\ ghc-options: -fspecialize-aggressively -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns -fno-warn-unused-imports -fno-warn-unused-binds -fno-warn-name-shadowing -fwarn-redundant-constraints -threaded -rtsopts -with-rtsopts=-N\n\
153-
\ main-is: Spec.hs\n\
154-
\ build-depends:\n\
155-
\ attoparsec\n\
156-
\ , base >=4.7 && <5\n\
157-
\ , hspec\n\
158-
\ , hspec-attoparsec\n\
159-
\ , implicit-hie\n\
160-
\ , text\n\
161-
\ default-language: Haskell2010\n"
162-
163-
libSection :: Text
164-
libSection =
165-
"library\n\
166-
\ exposed-modules:\n\
167-
\ Lib\n\
168-
\ other-modules:\n\
169-
\ Paths_implicit_hie\n\
170-
\ hs-source-dirs:\n\
171-
\ src\n\
172-
\ ghc-options: -fspecialize-aggressively -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns -fno-warn-unused-imports -fno-warn-unused-binds -fno-warn-name-shadowing -fwarn-redundant-constraints\n\
173-
\ build-depends:\n\
174-
\ attoparsec\n\
175-
\ , base >=4.7 && <5\n\
176-
\ , text\n\
177-
\ default-language: Haskell2010\n\
178-
\"
179-
180-
libSection2 :: Text
181-
libSection2 =
182-
"library\n\
183-
\ exposed-modules:\n\
184-
\ Lib\n\
185-
\ other-modules:\n\
186-
\ Paths_implicit_hie\n\
187-
\ hs-source-dirs:\n\
188-
\ src\n\
189-
\ hs-source-dirs:\n\
190-
\ src2\n\
191-
\ ghc-options: -fspecialize-aggressively -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns -fno-warn-unused-imports -fno-warn-unused-binds -fno-warn-name-shadowing -fwarn-redundant-constraints\n\
192-
\ build-depends:\n\
193-
\ attoparsec\n\
194-
\ , base >=4.7 && <5\n\
195-
\ , text\n\
196-
\ default-language: Haskell2010\n\
197-
\"
198-
199-
libSection3 :: Text
200-
libSection3 =
201-
"library\n\
202-
\ exposed-modules:\n\
203-
\ Lib\n\
204-
\ other-modules:\n\
205-
\ Paths_implicit_hie\n\
206-
\ hs-source-dirs:\n\
207-
\ src,\n\
208-
\ src2\n\
209-
\ ghc-options: -fspecialize-aggressively -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns -fno-warn-unused-imports -fno-warn-unused-binds -fno-warn-name-shadowing -fwarn-redundant-constraints\n\
210-
\ build-depends:\n\
211-
\ attoparsec\n\
212-
\ , base >=4.7 && <5\n\
213-
\ , text\n\
214-
\ default-language: Haskell2010\n\
215-
\"
216-
217-
exeSection2 :: Text
218-
exeSection2 =
219-
"executable gen-hie\n\
220-
\ other-modules:\n\
221-
\ Hie.Executable.Helper\n\
222-
\ Hie.Executable.Utils\n\
223-
\ hs-source-dirs:\n\
224-
\ app\n\
225-
\ main-is: Main.hs \n"

test/benchSection

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
name: folds-test
2+
version: 0.1
3+
14
benchmark folds
25
default-language: Haskell2010
36
hs-source-dirs: benchmarks

test/hie.yaml.cbl

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,2 @@
11
cradle:
22
cabal:
3-
- path: "src"
4-
component: "lib:haskell-language-server"
5-
6-
- path: "exe/Main.hs"
7-
component: "haskell-language-server:exe:haskell-language-server"
8-
9-
- path: "exe/Arguments.hs"
10-
component: "haskell-language-server:exe:haskell-language-server"
11-
12-
- path: "exe/Wrapper.hs"
13-
component: "haskell-language-server:exe:haskell-language-server-wrapper"
14-
15-
- path: "exe/Arguments.hs"
16-
component: "haskell-language-server:exe:haskell-language-server-wrapper"
17-
18-
- path: "test/functional"
19-
component: "haskell-language-server:test:func-test"
20-
21-
- path: "test/utils"
22-
component: "haskell-language-server:lib:hls-test-utils"

test/stackHie.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
cradle:
22
stack:
3-
- path: "src"
4-
component: "implicit-hie:lib"
3+
- path: "test/Spec.hs"
4+
component: "implicit-hie:test:implicit-hie-test"
55

66
- path: "app/Main.hs"
77
component: "implicit-hie:exe:gen-hie"
88

9-
- path: "test"
10-
component: "implicit-hie:test:implicit-hie-test"
9+
- path: "src/Hie/Cabal/Parser.hs"
10+
component: "implicit-hie:lib"
11+
12+
- path: "src/Hie/Locate.hs"
13+
component: "implicit-hie:lib"
14+
15+
- path: "src/Hie/Yaml.hs"
16+
component: "implicit-hie:lib"

0 commit comments

Comments
 (0)