summaryrefslogtreecommitdiff
path: root/lambda-calcul/haskell/src/Minilang
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud@pankzsoft.com>2026-03-22 10:54:07 +0100
committerArnaud Bailly <arnaud@pankzsoft.com>2026-03-22 10:54:07 +0100
commitafb965ca75a106063c36195a1c180baebe610115 (patch)
treefa06f42d2ef0b2c3c0b117a1bc8ddfed2a0184c5 /lambda-calcul/haskell/src/Minilang
parent91ae5eb9e16b00603c3dfa5ec123c64dd140765d (diff)
downloadlambda-nantes-afb965ca75a106063c36195a1c180baebe610115.tar.gz
Add integration test for all challenges
Diffstat (limited to 'lambda-calcul/haskell/src/Minilang')
-rw-r--r--lambda-calcul/haskell/src/Minilang/App.hs8
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