module ParserSpec where import Test.Hspec import Parse import Data.Either spec :: Spec spec = do describe "Basics of entries" $ do it "can parse integers" $ do let correct = Right $ Regular $ Integer 1 correct `shouldBe` parseWith regular "1" it "can parse string" $ do let input = "dit is een string" correct = Right $ Regular $ String input correct `shouldBe` parseWith regular ("\"" ++ input ++ "\"") it "can parse infinite" $ do let correct = Right $ Regular Infinite correct `shouldBe` parseWith regular "infinite" let wrong = Right $ Regular Infinite wrong `shouldNotBe` parseWith regular "infinitee" it "can parse entries" $ do let input = "id : \"dagger\"" correct = Right $ Entry "id" $ Regular $ String "dagger" correct `shouldBe` parseWith entry input let input = "x: 0" correct = Right $ Entry "x" $ Regular $ Integer 0 correct `shouldBe` parseWith entry input let input = "useTimes: infinite" correct = Right $ Entry "useTimes" $ Regular Infinite correct `shouldBe` parseWith entry input describe "Special kinds" $ do it "can parse actions" $ do let input = "actions: {}" correct = Right $ Entry "actions" $ Regular Infinite -- TODO Change this correct `shouldBe` parseWith action input it "can parse conditions" $ do pending it "can parse layouts" $ do pending describe "Lists and blocks" $ do it "can parse entities" $ do pending