module TypecheckTest where import Typecheck import Syntax import Test.Hspec typecheckTest :: Spec typecheckTest = describe "inferExpr" $ do it "can infer variables" $ do inferExpr (Var "a") [("a", TInt)] `shouldBe` Just TInt inferExpr (Var "a") [("a", TRecord [("b",TInt)])] `shouldBe` (Just $ TRecord [("b",TInt)]) inferExpr (Var "a") [("a", TVariant [("b",TInt)])] `shouldBe` (Just $ TVariant[("b",TInt)]) inferExpr (Var "a") [("a", TPtr TInt)] `shouldBe` ( Just $ TPtr TInt ) it "shouldn't infer undefined variables" $ do inferExpr (Var "a") [] `shouldBe` Nothing