diff --git a/tools/Language/SQL/SimpleSQL/Misc.lhs b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs similarity index 89% rename from tools/Language/SQL/SimpleSQL/Misc.lhs rename to tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs index c29367c..c4107ff 100644 --- a/tools/Language/SQL/SimpleSQL/Misc.lhs +++ b/tools/Language/SQL/SimpleSQL/QueryExprComponents.lhs @@ -1,17 +1,18 @@ -These is the tests for all the bits which aren't in the other files, -mainly query exprs except the tablerefs. These tests focus on one part -of the query expression. The FullQueries tests focus on parsing more -complex query expressions. +These are the tests for the query expression components apart from the +table refs which are in a separate file. -> module Language.SQL.SimpleSQL.Misc (miscTests) where + +These are a few misc tests which don't fit anywhere else. + +> module Language.SQL.SimpleSQL.QueryExprComponents (queryExprComponentTests) where > import Language.SQL.SimpleSQL.TestTypes > import Language.SQL.SimpleSQL.Syntax -> miscTests :: TestItem -> miscTests = Group "miscTests" +> queryExprComponentTests :: TestItem +> queryExprComponentTests = Group "queryExprComponentTests" > [duplicates > ,selectLists > ,whereClause @@ -21,7 +22,6 @@ complex query expressions. > ,limit > ,combos > ,withQueries -> ,queryExprsTests > ] @@ -184,13 +184,3 @@ complex query expressions. > ms1 = ms "a" "t" > ms2 = ms "a" "u" > ms3 = ms "a" "x" - -> queryExprsTests :: TestItem -> queryExprsTests = Group "query exprs" $ map (uncurry TestQueryExprs) -> [("select 1",[ms]) -> ,("select 1;",[ms]) -> ,("select 1;select 1",[ms,ms]) -> ,(" select 1;select 1; ",[ms,ms]) -> ] -> where -> ms = makeSelect {qeSelectList = [(Nothing,NumLit "1")]} diff --git a/tools/Language/SQL/SimpleSQL/QueryExprs.lhs b/tools/Language/SQL/SimpleSQL/QueryExprs.lhs new file mode 100644 index 0000000..48eb78f --- /dev/null +++ b/tools/Language/SQL/SimpleSQL/QueryExprs.lhs @@ -0,0 +1,18 @@ + +These are the tests for the queryExprs parsing which parses multiple +query expressions from one string. + +> module Language.SQL.SimpleSQL.QueryExprs (queryExprsTests) where + +> import Language.SQL.SimpleSQL.TestTypes +> import Language.SQL.SimpleSQL.Syntax + +> queryExprsTests :: TestItem +> queryExprsTests = Group "query exprs" $ map (uncurry TestQueryExprs) +> [("select 1",[ms]) +> ,("select 1;",[ms]) +> ,("select 1;select 1",[ms,ms]) +> ,(" select 1;select 1; ",[ms,ms]) +> ] +> where +> ms = makeSelect {qeSelectList = [(Nothing,NumLit "1")]} diff --git a/tools/Language/SQL/SimpleSQL/Tests.lhs b/tools/Language/SQL/SimpleSQL/Tests.lhs index 7396fdc..f699508 100644 --- a/tools/Language/SQL/SimpleSQL/Tests.lhs +++ b/tools/Language/SQL/SimpleSQL/Tests.lhs @@ -26,24 +26,28 @@ tpch tests > import Language.SQL.SimpleSQL.TestTypes > import Language.SQL.SimpleSQL.FullQueries -> import Language.SQL.SimpleSQL.Misc > import Language.SQL.SimpleSQL.Postgres +> import Language.SQL.SimpleSQL.QueryExprComponents +> import Language.SQL.SimpleSQL.QueryExprs + > import Language.SQL.SimpleSQL.TableRefs > import Language.SQL.SimpleSQL.ScalarExprs > import Language.SQL.SimpleSQL.Tpch - +Order the tests to start from the simplest first. This is also the +order on the generated documentation. > testData :: TestItem > testData = > Group "parserTest" -> [fullQueriesTests -> ,miscTests -> ,postgresTests +> [scalarExprTests +> ,queryExprComponentTests > ,tableRefTests -> ,scalarExprTests +> ,queryExprsTests +> ,fullQueriesTests +> ,postgresTests > ,tpchTests > ]