@@ -30,6 +30,7 @@ main = do
3030 ("x:=true where true and true", Right relationTrue),
3131 ("x:=true=true", Right relationTrue),
3232 ("x:=true=false", Right relationFalse),
33+ ("x:=true; undefine x", Right relationTrue),
3334 ("x:=relation {b int, a char}; insert x relation{tuple{b int(5), a char(\"spam\")}}", mkRelation simpleCAttributes (HS.fromList [RelationTuple $ M.fromList [("a", StringAtom "spam"), ("b", IntAtom 5)]])),
3435 ("x:=relation{tuple{b int(5),a char(\"spam\")},tuple{b int(6),a char(\"sam\")}}; delete x where b=6", mkRelation simpleCAttributes $ HS.fromList [RelationTuple $ M.fromList [("a", StringAtom "spam"), ("b", IntAtom 5)]])
3536 ]
@@ -50,4 +51,6 @@ assertTutdEqual databaseContext tutd expected = assertEqual tutd interpreted exp
5051 where
5152 interpreted = case interpret databaseContext tutd of
5253 (Just err, _) -> Left err
53− (Nothing, context) -> Right $ (relationVariables context) M.! "x"
54+ (Nothing, context) -> case M.lookup "x" (relationVariables context) of
55+ Nothing -> Left $ RelVarNotDefinedError "x"
56+ Just rel -> Right rel