first non trivial test
This commit is contained in:
parent
a1307b7403
commit
f0301d3c4e
4 changed files with 23 additions and 0 deletions
|
@ -56,6 +56,7 @@ test-suite lish-test
|
|||
default-language: Haskell2010
|
||||
ghc-options: -Wall -Werror -O2 -threaded -rtsopts -with-rtsopts=-N
|
||||
hs-source-dirs: src-test
|
||||
exposed-modules: Lish.Test.Parser
|
||||
main-is: Main.hs
|
||||
build-depends: base >= 4.8 && < 5
|
||||
, tasty >= 0.11
|
||||
|
|
19
src-test/Lish/Test/Parser.hs
Normal file
19
src-test/Lish/Test/Parser.hs
Normal file
|
@ -0,0 +1,19 @@
|
|||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Lish.Test.Parser
|
||||
where
|
||||
|
||||
import Protolude
|
||||
import Test.Tasty
|
||||
import Test.Tasty.HUnit
|
||||
import Test.Tasty.SmallCheck
|
||||
|
||||
import Lish.Parser
|
||||
import Lish.Types
|
||||
|
||||
parseTests :: [TestTree]
|
||||
parseTests =
|
||||
[ testCase "simple commands" simpleCommand ]
|
||||
|
||||
simpleCommand :: Assertion
|
||||
simpleCommand = parseCmd "ls" @?= Right (Atom "ls")
|
|
@ -3,6 +3,7 @@ import Test.Tasty.HUnit
|
|||
import Test.Tasty.SmallCheck
|
||||
|
||||
import Lib (inc)
|
||||
import Lish.Test.Parser
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain $ testGroup "all-tests" tests
|
||||
|
@ -11,6 +12,7 @@ tests :: [TestTree]
|
|||
tests =
|
||||
[ testGroup "SmallCheck" scTests
|
||||
, testGroup "Unit tests" huTests
|
||||
, testGroup "Lish.Parser" parseTests
|
||||
]
|
||||
|
||||
scTests :: [TestTree]
|
||||
|
|
|
@ -31,6 +31,7 @@ data SExp = Atom Text
|
|||
}
|
||||
| Stream CmdStream
|
||||
| WaitingStream CmdStream
|
||||
deriving (Eq)
|
||||
|
||||
instance Show SExp where
|
||||
show = toS . repr
|
||||
|
|
Loading…
Reference in a new issue