Skip to content

Commit 06b82bf

Browse files
committed
Fix benchmark test
1 parent bacaa23 commit 06b82bf

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/Hie/Cabal/Parser.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Data.Attoparsec.Text
88
import Data.Char (isSpace)
99
import Data.Text (Text)
1010
import qualified Data.Text as T
11+
import Debug.Trace
1112

1213
type Name = Text
1314

@@ -45,8 +46,11 @@ parsePackage =
4546

4647
componentHeader :: Indent -> Text -> Parser Name
4748
componentHeader i t = do
49+
traceM $ "indent" <> show i
4850
indent i
51+
traceM $ "asciiCI" <> T.unpack t
4952
_ <- asciiCI t
53+
traceM "parseString"
5054
skipMany tabOrSpace
5155
n <- parseString <|> pure ""
5256
skipToNextLine

test/Spec.hs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ spec = do
2626
$ it "successfully parses library section"
2727
$ libSection ~> parseLib 0
2828
`shouldParse` Lib "" "src"
29+
describe "Should Succeed"
30+
$ it "successfully parses bench section"
31+
$ benchSection ~> parseBench 0
32+
`shouldParse` Bench "folds" "benchmarks/folds.hs"
2933
describe "Should Succeed"
3034
$ it "successfully parses package"
3135
$ fullFile ~> parsePackage
@@ -57,23 +61,23 @@ fullFile = "name: implicit-hie\n" <> libSection <> exeSection <> testSection
5761
exeSection :: Text
5862
exeSection =
5963
"executable implicit-hie-exe\n\
60-
\ main-is: Main.hs \n\
6164
\ other-modules:\n\
6265
\ Paths_implicit_hie\n\
6366
\ hs-source-dirs:\n\
6467
\ app\n\
65-
\ ghc-options: -O2\n"
68+
\ ghc-options: -O2\n\
69+
\ main-is: Main.hs \n"
6670

6771
testSection :: Text
6872
testSection =
6973
"test-suite implicit-hie-test\n\
7074
\ type: exitcode-stdio-1.0\n\
71-
\ main-is: Spec.hs\n\
7275
\ other-modules:\n\
7376
\ Paths_implicit_hie\n\
7477
\ hs-source-dirs:\n\
7578
\ test\n\
7679
\ 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\
80+
\ main-is: Spec.hs\n\
7781
\ build-depends:\n\
7882
\ attoparsec\n\
7983
\ , base >=4.7 && <5\n\
@@ -100,6 +104,15 @@ libSection =
100104
\ default-language: Haskell2010\n\
101105
\"
102106

107+
benchSection :: Text
108+
benchSection =
109+
"benchmark folds\n\
110+
\ default-language: Haskell2010\n\
111+
\ hs-source-dirs: benchmarks\n\
112+
\ ghc-options: -Wall -threaded\n\
113+
\ type: exitcode-stdio-1.0\n\
114+
\ main-is: folds.hs\n"
115+
103116
stackHie :: Text
104117
stackHie =
105118
"cradle:\n\

0 commit comments

Comments
 (0)