From 1294b57dbbec16f2b9c1a07542a970f38e1b735d Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 1 May 2014 02:15:24 +1000 Subject: Added initial tests for grasp parser --- src/Grasp/Test.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/Grasp/Test.hs (limited to 'src/Grasp/Test.hs') diff --git a/src/Grasp/Test.hs b/src/Grasp/Test.hs new file mode 100644 index 0000000..ec45fb3 --- /dev/null +++ b/src/Grasp/Test.hs @@ -0,0 +1,38 @@ +module Grasp.Test ( + parserTests, + tests + ) where + + +import Test.HUnit +import Text.Parsec.Error +import Grasp.Parser + + +instance Eq Text.Parsec.Error.ParseError + + + + +isParseError :: Either a b -> Bool +isParseError (Left _) = True +isParseError (Right _) = False + + + +parser0 = TestCase (assertBool "" (isParseError (parseGrasp "")) ) + +parser1 = TestCase (assertBool "" (isParseError (parseGrasp "digraph {")) ) + +parser2 = TestCase (assertBool "" (isParseError (parseGrasp "digraph { }")) ) + + + +parserTests :: Test +parserTests = TestList [parser0, parser1, parser2] + + + +tests :: Test +tests = parserTests + -- cgit