diff options
| author | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-03 21:22:52 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-03 21:22:52 +0100 |
| commit | 16e0642ee4d09df1b032f8d30c7050cfac4d12f7 (patch) | |
| tree | ef395f11b8a8bb0d54bd53515fd352af0a50bd65 /lambda-calcul/haskell/test/Minilang/REPL/NetSpec.hs | |
| parent | 78fac35c6e7a987bc2b6a37d78cd2c07c3a0efa2 (diff) | |
| download | lambda-nantes-16e0642ee4d09df1b032f8d30c7050cfac4d12f7.tar.gz | |
Handle :lang in REPL
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 |
