on master help sign in
add With test
commit611102855a2f2fc981caad53da84b574e5c23f89 authorAgentM <agentm@themactionfaction.com> dateWed 25 Jul 2018, 23:37 (8 years ago) parent41999da
1 file changed+17−2
test/TutorialD/Interpreter.hs+17−2
test/TutorialD/Interpreter.hs+17−2
@@ -71,7 +71,8 @@ main = do
7171 testIntervalType,
7272 testArbitraryRelation,
7373 testNonEmptyListType,
74− testUnresolvedAtomTypes
74+ testUnresolvedAtomTypes,
75+ testWithClause
7576 ]
7677 simpleRelTests = [("x:=true", Right relationTrue),
7778 ("x:=false", Right relationFalse),
@@ -616,4 +617,18 @@ testUnresolvedAtomTypes = TestCase $ do
616617 let err1 = "TypeConstructorTypeVarMissing"
617618 expectTutorialDErr sessionId dbconn (T.isPrefixOf err1) "x:=relation{tuple{a Empty}}"
618619 executeTutorialD sessionId dbconn "x:=relation{a List Int}{tuple{a Empty}}"
619−
620+
621+-- with (x as s) s
622+testWithClause :: Test
623+testWithClause = TestCase $ do
624+ (sessionId, dbconn) <- dateExamplesConnection emptyNotificationCallback
625+ executeTutorialD sessionId dbconn "x:=with (x as s) x"
626+ eX <- executeRelationalExpr sessionId dbconn (RelationVariable "x" ())
627+ assertEqual "with x as s" (Right suppliersRel) eX
628+
629+ let err1 = "RelVarAlreadyDefinedError"
630+ expectTutorialDErr sessionId dbconn (T.isPrefixOf err1) "x:=with (s as s) s"
631+
632+ expectTutorialDErr sessionId dbconn (T.isPrefixOf err1) "x:=with (s as sp) s"
633+
634+