2019-08-31 14:50:12 +02:00
|
|
|
|
|
|
|
> module Language.SQL.SimpleSQL.CustomDialect (customDialectTests) where
|
|
|
|
|
|
|
|
> import Language.SQL.SimpleSQL.TestTypes
|
|
|
|
|
|
|
|
> customDialectTests :: TestItem
|
2019-09-01 10:34:10 +02:00
|
|
|
> customDialectTests = Group "custom dialect tests" (map (uncurry ParseQueryExpr) passTests
|
|
|
|
> ++ map (uncurry ParseScalarExprFails) failTests )
|
2019-08-31 14:50:12 +02:00
|
|
|
> where
|
2019-09-01 10:34:10 +02:00
|
|
|
> failTests = [(ansi2011,"SELECT DATE('2000-01-01')")
|
|
|
|
> ,(ansi2011,"SELECT DATE")
|
|
|
|
> ,(dateApp,"SELECT DATE")
|
|
|
|
> ,(dateIden,"SELECT DATE('2000-01-01')")
|
|
|
|
> -- show this never being allowed as an alias
|
|
|
|
> ,(ansi2011,"SELECT a date")
|
|
|
|
> ,(dateApp,"SELECT a date")
|
|
|
|
> ,(dateIden,"SELECT a date")
|
|
|
|
> ]
|
|
|
|
> passTests = [(ansi2011,"SELECT a b")
|
|
|
|
> ,(noDateKeyword,"SELECT DATE('2000-01-01')")
|
|
|
|
> ,(noDateKeyword,"SELECT DATE")
|
|
|
|
> ,(dateApp,"SELECT DATE('2000-01-01')")
|
|
|
|
> ,(dateIden,"SELECT DATE")
|
|
|
|
> ]
|
|
|
|
> noDateKeyword = ansi2011 {diKeywords = filter (/="date") (diKeywords ansi2011)}
|
|
|
|
> dateIden = ansi2011 {diIdentifierKeywords = "date" : diIdentifierKeywords ansi2011}
|
|
|
|
> dateApp = ansi2011 {diAppKeywords = "date" : diAppKeywords ansi2011}
|