diff options
Diffstat (limited to 'lambda-calcul/haskell/src')
| -rw-r--r-- | lambda-calcul/haskell/src/Minilang/App.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lambda-calcul/haskell/src/Minilang/App.hs b/lambda-calcul/haskell/src/Minilang/App.hs index cce48f7..3373b75 100644 --- a/lambda-calcul/haskell/src/Minilang/App.hs +++ b/lambda-calcul/haskell/src/Minilang/App.hs @@ -22,7 +22,7 @@ import Minilang.API (Challenge (..), LambdaAPI, Score (..), Token (..), User (.. import Minilang.Lambda.Parser (pretty) import Minilang.REPL (withInputs) import Minilang.REPL.Purer (PurerEnv (..)) -import Minilang.REPL.Types (In (..), Out (..), initialREPL) +import Minilang.REPL.Types (Command (..), Content (..), In (..), Out (..), initialREPL) import Network.Wai.Application.Static (defaultFileServerSettings, staticApp) import Servant (ServerT, err400, err500, errBody, (:<|>) (..), err404) import Servant.Server (Application, Handler (..), Tagged (..)) @@ -147,7 +147,7 @@ postAnswer Nothing _ = liftIO $ throwM $ err400 {errBody = "Missing token"} postAnswer (Just token) expected = do checkUserToken token Challenge {expr} <- getCurrentChallenge token - let PurerEnv {outputs} = withInputs initialREPL [In expr] + let PurerEnv {outputs} = withInputs initialREPL [Com (Load (Data expr))] result = evaluateOutputs outputs expected updateUserLastTest token result case result of @@ -171,6 +171,10 @@ evaluateOutputs outputs expected = if pretty ast /= expected then TestFailed "Incorrect result" else TestSucceeded + [Bye] -> + if expected == "" + then TestSucceeded + else TestFailed "Incorrect result" [Bye, Msg msg] -> TestFailed msg _ -> TestErrored $ pack $ show outputs |
