Added tests for new added sqlserver dialect syntax.
This commit is contained in:
parent
efd4dea6ff
commit
61275461b5
|
@ -254,6 +254,11 @@ Try to do this when this code is ported to a modern pretty printing lib.
|
|||
> scalarExpr d (OdbcFunc e) =
|
||||
> text "{fn" <+> scalarExpr d e <> text "}"
|
||||
|
||||
> scalarExpr d (Convert t e Nothing) =
|
||||
> text "convert(" <> typeName t <> text "," <+> scalarExpr d e <> text ")"
|
||||
> scalarExpr d (Convert t e (Just i)) =
|
||||
> text "convert(" <> typeName t <> text "," <+> scalarExpr d e <> text "," <+> text (show i) <> text ")"
|
||||
|
||||
> unname :: Name -> String
|
||||
> unname (Name Nothing n) = n
|
||||
> unname (Name (Just (s,e)) n) =
|
||||
|
|
|
@ -318,8 +318,8 @@ the + or -.
|
|||
> [ LexTest sqlserver {diOdbc = True} s t | (s,t) <-
|
||||
> [("{}", [Symbol "{", Symbol "}"])
|
||||
> ]]
|
||||
> ++ [LexFails sqlserver "{"
|
||||
> ,LexFails sqlserver "}"]
|
||||
> ++ [LexFails sqlserver {diOdbc = False} "{"
|
||||
> ,LexFails sqlserver {diOdbc = False} "}"]
|
||||
|
||||
> combos :: [a] -> Int -> [[a]]
|
||||
> combos _ 0 = [[]]
|
||||
|
|
|
@ -5,7 +5,7 @@ Tests for parsing scalar expressions
|
|||
|
||||
> import Language.SQL.SimpleSQL.TestTypes
|
||||
> import Language.SQL.SimpleSQL.Syntax
|
||||
|
||||
|
||||
> scalarExprTests :: TestItem
|
||||
> scalarExprTests = Group "scalarExprTests"
|
||||
> [literals
|
||||
|
@ -15,6 +15,7 @@ Tests for parsing scalar expressions
|
|||
> ,dots
|
||||
> ,app
|
||||
> ,caseexp
|
||||
> ,convertfun
|
||||
> ,operators
|
||||
> ,parens
|
||||
> ,subqueries
|
||||
|
@ -110,6 +111,16 @@ Tests for parsing scalar expressions
|
|||
|
||||
> ]
|
||||
|
||||
> convertfun :: TestItem
|
||||
> convertfun = Group "convert" $ map (uncurry (TestScalarExpr sqlserver))
|
||||
> [("CONVERT(varchar, 25.65)"
|
||||
> ,Convert (TypeName [Name Nothing "varchar"]) (NumLit "25.65") Nothing)
|
||||
> ,("CONVERT(datetime, '2017-08-25')"
|
||||
> ,Convert (TypeName [Name Nothing "datetime"]) (StringLit "'" "'" "2017-08-25") Nothing)
|
||||
> ,("CONVERT(varchar, '2017-08-25', 101)"
|
||||
> ,Convert (TypeName [Name Nothing "varchar"]) (StringLit "'" "'" "2017-08-25") (Just 101))
|
||||
> ]
|
||||
|
||||
> operators :: TestItem
|
||||
> operators = Group "operators"
|
||||
> [binaryOperators
|
||||
|
|
Loading…
Reference in a new issue