1
Fork 0

fix bug in parsing default as all instead of distinct for set operations

This commit is contained in:
Jake Wheat 2014-04-15 13:47:34 +03:00
parent 4989f5251b
commit 8b1fa81de7
4 changed files with 30 additions and 11 deletions
tools/Language/SQL/SimpleSQL

View file

@ -144,10 +144,10 @@ These are a few misc tests which don't fit anywhere else.
> combos :: TestItem
> combos = Group "combos" $ map (uncurry TestQueryExpr)
> [("select a from t union select b from u"
> ,CombineQueryExpr ms1 Union All Respectively ms2)
> ,CombineQueryExpr ms1 Union Distinct Respectively ms2)
> ,("select a from t intersect select b from u"
> ,CombineQueryExpr ms1 Intersect All Respectively ms2)
> ,CombineQueryExpr ms1 Intersect Distinct Respectively ms2)
> ,("select a from t except all select b from u"
> ,CombineQueryExpr ms1 Except All Respectively ms2)
@ -160,8 +160,8 @@ These are a few misc tests which don't fit anywhere else.
> -- TODO: union should be left associative. I think the others also
> -- so this needs to be fixed (new optionSuffix variation which
> -- handles this)
> ,CombineQueryExpr ms1 Union All Respectively
> (CombineQueryExpr ms1 Union All Respectively ms1))
> ,CombineQueryExpr ms1 Union Distinct Respectively
> (CombineQueryExpr ms1 Union Distinct Respectively ms1))
> ]
> where
> ms1 = makeSelect

View file

@ -79,9 +79,12 @@ order on the generated documentation.
> let str' = pp got
> let egot' = parser "" Nothing str'
> case egot' of
> Left e' -> H.assertFailure $ "pp roundtrip "
> Left e' -> H.assertFailure $ "pp roundtrip"
> ++ "\n" ++ str'
> ++ peFormattedError e'
> Right got' -> H.assertEqual "pp roundtrip" expected got'
> Right got' -> H.assertEqual
> ("pp roundtrip" ++ "\n" ++ str')
> expected got'
> toPTest :: (Eq a, Show a) =>
> (String -> Maybe (Int,Int) -> String -> Either ParseError a)
@ -97,5 +100,6 @@ order on the generated documentation.
> let egot' = parser "" Nothing str'
> case egot' of
> Left e' -> H.assertFailure $ "pp roundtrip "
> ++ "\n" ++ str' ++ "\n"
> ++ peFormattedError e'
> Right _got' -> return ()