Fix benchmark test

This commit is contained in:
Avi Dessauer 2020-05-07 00:37:50 -04:00
parent bacaa2350e
commit 06b82bf605
2 changed files with 20 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import Data.Attoparsec.Text
import Data.Char (isSpace)
import Data.Text (Text)
import qualified Data.Text as T
import Debug.Trace
type Name = Text
@ -45,8 +46,11 @@ parsePackage =
componentHeader :: Indent -> Text -> Parser Name
componentHeader i t = do
traceM $ "indent" <> show i
indent i
traceM $ "asciiCI" <> T.unpack t
_ <- asciiCI t
traceM "parseString"
skipMany tabOrSpace
n <- parseString <|> pure ""
skipToNextLine

View File

@ -26,6 +26,10 @@ spec = do
$ it "successfully parses library section"
$ libSection ~> parseLib 0
`shouldParse` Lib "" "src"
describe "Should Succeed"
$ it "successfully parses bench section"
$ benchSection ~> parseBench 0
`shouldParse` Bench "folds" "benchmarks/folds.hs"
describe "Should Succeed"
$ it "successfully parses package"
$ fullFile ~> parsePackage
@ -57,23 +61,23 @@ fullFile = "name: implicit-hie\n" <> libSection <> exeSection <> testSection
exeSection :: Text
exeSection =
"executable implicit-hie-exe\n\
\ main-is: Main.hs \n\
\ other-modules:\n\
\ Paths_implicit_hie\n\
\ hs-source-dirs:\n\
\ app\n\
\ ghc-options: -O2\n"
\ ghc-options: -O2\n\
\ main-is: Main.hs \n"
testSection :: Text
testSection =
"test-suite implicit-hie-test\n\
\ type: exitcode-stdio-1.0\n\
\ main-is: Spec.hs\n\
\ other-modules:\n\
\ Paths_implicit_hie\n\
\ hs-source-dirs:\n\
\ test\n\
\ 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\
\ main-is: Spec.hs\n\
\ build-depends:\n\
\ attoparsec\n\
\ , base >=4.7 && <5\n\
@ -100,6 +104,15 @@ libSection =
\ default-language: Haskell2010\n\
\"
benchSection :: Text
benchSection =
"benchmark folds\n\
\ default-language: Haskell2010\n\
\ hs-source-dirs: benchmarks\n\
\ ghc-options: -Wall -threaded\n\
\ type: exitcode-stdio-1.0\n\
\ main-is: folds.hs\n"
stackHie :: Text
stackHie =
"cradle:\n\