first non trivial test

This commit is contained in:
Yann Esposito (Yogsototh) 2017-02-27 08:54:54 +01:00
parent a1307b7403
commit f0301d3c4e
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
4 changed files with 23 additions and 0 deletions

View file

@ -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

View 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")

View file

@ -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]

View file

@ -31,6 +31,7 @@ data SExp = Atom Text
}
| Stream CmdStream
| WaitingStream CmdStream
deriving (Eq)
instance Show SExp where
show = toS . repr