diff options
Diffstat (limited to 'lambda-calcul/haskell/test/Minilang/REPL/NetSpec.hs')
| -rw-r--r-- | lambda-calcul/haskell/test/Minilang/REPL/NetSpec.hs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lambda-calcul/haskell/test/Minilang/REPL/NetSpec.hs b/lambda-calcul/haskell/test/Minilang/REPL/NetSpec.hs index 076b073..b8f8b22 100644 --- a/lambda-calcul/haskell/test/Minilang/REPL/NetSpec.hs +++ b/lambda-calcul/haskell/test/Minilang/REPL/NetSpec.hs @@ -6,8 +6,9 @@ import Control.Concurrent.STM.TVar import Control.Exception (bracket) import Control.Monad (forM) import Data.Aeson (eitherDecode, encode) -import Minilang.Lambda.Eval (newEnv) +import Minilang.Lambda.Eval (Term (..), newEnv) import Minilang.Lambda.Infer (newContext) +import Minilang.Lambda.Unify (Type (..)) import Minilang.Log import Minilang.REPL.Net import Minilang.REPL.Types @@ -65,16 +66,19 @@ temporaryFile = bracket newTempFile removeFile spec :: Spec spec = around withServer $ describe "MiniLang Network REPL" $ do - -- it "evaluates definition and returns defined symbol" $ \Server {serverPort} -> do - -- let inp = [In "Unit : U = Sum(tt)"] - -- expectedOutput = [Right $ Defined (B "Unit") (U 0)] - -- res <- runTestClient serverPort ".newenv1" inp + it "evaluates expression and returns evaluation result" $ \Server {serverPort} -> do + let inp = [In "((lam (x) x) y)"] + expectedOutput = [Right $ Evaluated (Var "y") (TyVar "b")] + res <- runTestClient serverPort ".newenv1" inp - -- res `shouldBe` expectedOutput + res `shouldBe` expectedOutput it "allows retrieving empty initial env" $ \Server {serverPort} -> do - let inp = [Com DumpEnv] - expectedOutput = [Right $ CurrentEnv newEnv newContext] + let inp = [Com (Set (SelectLanguage Untyped)), Com DumpEnv] + expectedOutput = + [ Right (Msg "Language set to Untyped"), + Right $ CurrentEnv newEnv newContext Untyped + ] res <- runTestClient serverPort ".newenv2" inp res `shouldBe` expectedOutput |
