on master help sign in
Fix failure to typecheck test case by pushing all assertions to the end of the test and operating with all dependencies on the Either type inside a do block.
commit7290d322b77b75771d7e529ef05e3b8f6563caa3 authorDiogo Biazus <diogo@biazus.me> dateSat 16 Dec 2017, 23:04 (9 years ago) parent9d195a0
1 file changed+8−3
test/Relation/StaticOptimizer.hs+8−3
test/Relation/StaticOptimizer.hs+8−3
@@ -130,9 +130,14 @@ testPushDownRestrictionPredicate = TestCase $ do
130130 Right rel -> pure rel
131131 let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
132132 status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
133+ relationsOrError = do
134+ stevens <- mkRelationFromList (attributes suppliersRel) [[TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]]
135+ let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
136+ status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
133137
134− expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
135− assertEqual "union restriction pushdown" expectedExpr1 (applyStaticRestrictionPushdown expr1)
138+ expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
139+ pure $ (expectedExpr1, (applyStaticRestrictionPushdown expr1))
140+ either (assertFailure . (++) "stevens relation: " . show) (uncurry $ assertEqual "union restriction pushdown") relationsOrError
136141
137142 -- s{sname,city} where city="London" == (s where city="London"){sname,city}
138143 let expr2 = Restrict whereLondon (Project projAttrs2 rvs)
@@ -144,4 +149,4 @@ testPushDownRestrictionPredicate = TestCase $ do
144149 -- (s where city="London"){sname} != s{sname} where city="London" (no "city" attribute at projection time)
145150 let expr3 = Project projAttrs3 (Restrict whereLondon rvs)
146151 projAttrs3 = AttributeNames (S.singleton "sname")
147− assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)
152+ assertEqual "projection restriction no-pushdown" expr3 (applyStaticRestrictionPushdown expr3)