diff --git a/simple-sql-parser.cabal b/simple-sql-parser.cabal index db4c4cb..8432372 100644 --- a/simple-sql-parser.cabal +++ b/simple-sql-parser.cabal @@ -90,7 +90,8 @@ Test-Suite Tests Language.SQL.SimpleSQL.Tests, Language.SQL.SimpleSQL.Tpch, Language.SQL.SimpleSQL.ScalarExprs, - Language.SQL.SimpleSQL.LexerTests + Language.SQL.SimpleSQL.LexerTests, + Language.SQL.SimpleSQL.CustomDialect other-extensions: TupleSections,DeriveDataTypeable default-language: Haskell2010 diff --git a/tools/Language/SQL/SimpleSQL/CustomDialect.lhs b/tools/Language/SQL/SimpleSQL/CustomDialect.lhs new file mode 100644 index 0000000..ab04d5b --- /dev/null +++ b/tools/Language/SQL/SimpleSQL/CustomDialect.lhs @@ -0,0 +1,11 @@ + +> module Language.SQL.SimpleSQL.CustomDialect (customDialectTests) where + +> import Language.SQL.SimpleSQL.TestTypes + +> customDialectTests :: TestItem +> customDialectTests = Group "custom dialect tests" (map (ParseQueryExpr myDialect) sometests +> ++ [ParseScalarExprFails ansi2011 "SELECT DATE('2000-01-01')"]) +> where +> myDialect = ansi2011 {diKeywords = filter (/="date") (diKeywords ansi2011)} +> sometests = ["SELECT DATE('2000-01-01')"] diff --git a/tools/Language/SQL/SimpleSQL/TestTypes.lhs b/tools/Language/SQL/SimpleSQL/TestTypes.lhs index 90d7034..dbdf140 100644 --- a/tools/Language/SQL/SimpleSQL/TestTypes.lhs +++ b/tools/Language/SQL/SimpleSQL/TestTypes.lhs @@ -4,11 +4,12 @@ Tests.lhs module for the 'interpreter'. > module Language.SQL.SimpleSQL.TestTypes > (TestItem(..) -> ,ansi2011,mysql,postgres,oracle,sqlserver -> ,diOdbc) where +> ,module Language.SQL.SimpleSQL.Dialect +> ) where > import Language.SQL.SimpleSQL.Syntax > import Language.SQL.SimpleSQL.Lex (Token) +> import Language.SQL.SimpleSQL.Dialect TODO: maybe make the dialect args into [dialect], then each test checks all the dialects mentioned work, and all the dialects not diff --git a/tools/Language/SQL/SimpleSQL/Tests.lhs b/tools/Language/SQL/SimpleSQL/Tests.lhs index 8b5baf1..0c0c3ca 100644 --- a/tools/Language/SQL/SimpleSQL/Tests.lhs +++ b/tools/Language/SQL/SimpleSQL/Tests.lhs @@ -38,6 +38,7 @@ test data to the Test.Framework tests. > import Language.SQL.SimpleSQL.MySQL > import Language.SQL.SimpleSQL.Oracle +> import Language.SQL.SimpleSQL.CustomDialect Order the tests to start from the simplest first. This is also the order on the generated documentation. @@ -62,6 +63,7 @@ order on the generated documentation. > ,sql2011BitsTests > ,mySQLTests > ,oracleTests +> ,customDialectTests > ] > tests :: T.TestTree