Skip to content
Snippets Groups Projects
Commit f46c4a52 authored by Eduardo Trujillo's avatar Eduardo Trujillo
Browse files

test(Parsers): Add initial parses tests

parent 83497380
No related branches found
No related tags found
No related merge requests found
File moved
hie.yaml 0 → 100644
cradle:
stack:
- path: "./src"
component: "shift:lib"
- path: "./app"
component: "shift:exe"
- path: "./test/Spec.hs"
component: "shift:test:spec"
- path: "./test/Test"
component: "shift:test:spec"
- path: "./Doctest.hs"
component: "shift:test:doctest"
......@@ -68,10 +68,17 @@ executables:
- shift
tests:
doctest:
main: Doctest.hs
spec:
main: Spec.hs
source-dirs:
- test
dependencies:
- shift
- hspec
- hspec-discover
- hspec-megaparsec
doctest:
main: Doctest.hs
dependencies:
- shift
- doctest
......@@ -19,7 +19,8 @@ license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
test/Doctest.hs
test/Spec.hs
test/Test/Shift/ParsersSpec.hs
library
exposed-modules:
......@@ -106,6 +107,43 @@ test-suite doctest
main-is: Doctest.hs
other-modules:
Paths_shift
ghc-options: -Wall
build-depends:
aeson
, base >=4.7 && <5
, bytestring
, cmark-gfm
, containers
, data-default
, doctest
, exceptions
, github
, hgit
, http-client
, http-client-tls
, io-memoize
, lens
, megaparsec
, mtl
, optparse-applicative
, process
, scotty
, semigroups
, shift
, string-conversions
, text
, transformers
, unordered-containers
, vector
, versions
default-language: Haskell2010
test-suite spec
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
Test.Shift.ParsersSpec
Paths_shift
hs-source-dirs:
test
ghc-options: -Wall
......@@ -116,10 +154,12 @@ test-suite doctest
, cmark-gfm
, containers
, data-default
, doctest
, exceptions
, github
, hgit
, hspec
, hspec-discover
, hspec-megaparsec
, http-client
, http-client-tls
, io-memoize
......
......@@ -88,7 +88,7 @@ data CommitType
| CTRefactor
| CTTest
| CTChore
deriving (Show)
deriving (Show, Eq)
data BreakingChange = BreakingChange
{ _bcSubject :: Text,
......
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
\ No newline at end of file
{-# LANGUAGE OverloadedStrings #-}
module Test.Shift.ParsersSpec where
import Shift.Parsers (commitType)
import Shift.Types (CommitType (CTFeature))
import Test.Hspec (Spec, describe, it)
import Test.Hspec.Megaparsec (shouldFailOn, shouldParse)
import Text.Megaparsec (parse)
spec :: Spec
spec = do
describe "commitType" $ do
it "parses a commit type" $ do
parse commitType "" "feat" `shouldParse` CTFeature
it "should fail if the commit type is unknown" $ do
parse commitType "" `shouldFailOn` "omg"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment