start new file for the sql 2011 tests based on the grammar from the draft standard
This commit is contained in:
parent
d69f1752a5
commit
ccd0e6708f
2
TODO
2
TODO
|
@ -5,6 +5,8 @@ continue 2003 review and tests
|
|||
- base of error messages but add some more variations
|
||||
3. start thinking about tests for invalid syntax
|
||||
|
||||
review names in the syntax for correspondence with sql standard, avoid
|
||||
gratuitous differences
|
||||
|
||||
touch up the expr hack as best as can
|
||||
|
||||
|
|
|
@ -53,16 +53,19 @@ Test-Suite Tests
|
|||
Language.SQL.SimpleSQL.Parser,
|
||||
Language.SQL.SimpleSQL.Syntax,
|
||||
|
||||
Language.SQL.SimpleSQL.ErrorMessages,
|
||||
Language.SQL.SimpleSQL.FullQueries,
|
||||
Language.SQL.SimpleSQL.GroupBy,
|
||||
Language.SQL.SimpleSQL.Postgres,
|
||||
Language.SQL.SimpleSQL.QueryExprComponents,
|
||||
Language.SQL.SimpleSQL.QueryExprs,
|
||||
Language.SQL.SimpleSQL.ValueExprs,
|
||||
Language.SQL.SimpleSQL.SQL2003,
|
||||
Language.SQL.SimpleSQL.SQL2011,
|
||||
Language.SQL.SimpleSQL.TableRefs,
|
||||
Language.SQL.SimpleSQL.TestTypes,
|
||||
Language.SQL.SimpleSQL.Tests,
|
||||
Language.SQL.SimpleSQL.Tpch
|
||||
Language.SQL.SimpleSQL.Tpch,
|
||||
Language.SQL.SimpleSQL.ValueExprs
|
||||
|
||||
other-extensions: TupleSections,OverloadedStrings,DeriveDataTypeable
|
||||
default-language: Haskell2010
|
||||
|
|
35
tools/Filter.lhs
Normal file
35
tools/Filter.lhs
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
> import System.IO
|
||||
> import System.Environment
|
||||
|
||||
|
||||
> main :: IO ()
|
||||
> main = do
|
||||
> [a] <- getArgs
|
||||
> r <- readFile a
|
||||
> let ls = lines r
|
||||
> a = noAdjacentBlankLines ls
|
||||
> b = concat $ combineGroups $ group [] a
|
||||
> putStrLn $ unlines b
|
||||
|
||||
> noAdjacentBlankLines [] = []
|
||||
> noAdjacentBlankLines [a] = [a]
|
||||
> noAdjacentBlankLines ("":xs@("":_)) = noAdjacentBlankLines xs
|
||||
> noAdjacentBlankLines (x:xs) = x:noAdjacentBlankLines xs
|
||||
|
||||
> group :: [String] -> [String] -> [[String]]
|
||||
> group acc [] = [acc]
|
||||
> group acc ("":xs) = reverse ("":acc) : group [] xs
|
||||
> group acc (x:xs) = group (x : acc) xs
|
||||
|
||||
> combineGroups :: [[String]] -> [[String]]
|
||||
> combineGroups [] = []
|
||||
> combineGroups (x@(('<':_):_):xs) | gs <- map trim x
|
||||
> , ns <- trim $ unwords gs
|
||||
> , length ns < 80 = [ns ++ "\n"] : combineGroups xs
|
||||
> combineGroups (x:xs) = x:combineGroups xs
|
||||
|
||||
> trim :: String -> String
|
||||
> trim = x . x
|
||||
> where
|
||||
> x = dropWhile (==' ') . reverse
|
24
tools/FilterSpaces.lhs
Normal file
24
tools/FilterSpaces.lhs
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
> --import System.IO
|
||||
> import System.Environment
|
||||
|
||||
> main :: IO ()
|
||||
> main = do
|
||||
> [a] <- getArgs
|
||||
> r <- readFile a
|
||||
> let ls = lines r
|
||||
> putStrLn $ unlines $ map dedupeSpaces ls
|
||||
|
||||
|
||||
> dedupeSpaces :: String -> String
|
||||
> dedupeSpaces [] = []
|
||||
> -- don't start until after the leading spaces
|
||||
> -- including literate haskell source lines
|
||||
> dedupeSpaces xs@(x:_) | x `notElem` " >" = dedupeSpaces' xs
|
||||
> dedupeSpaces (x:xs) = x : dedupeSpaces xs
|
||||
|
||||
> dedupeSpaces' :: String -> String
|
||||
> dedupeSpaces' (' ':xs@(' ':_)) = dedupeSpaces' xs
|
||||
> dedupeSpaces' (x:xs) = x : dedupeSpaces' xs
|
||||
> dedupeSpaces' [] = []
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,7 @@ test data to the Test.Framework tests.
|
|||
> import Language.SQL.SimpleSQL.Tpch
|
||||
|
||||
> import Language.SQL.SimpleSQL.SQL2003
|
||||
> import Language.SQL.SimpleSQL.SQL2011
|
||||
|
||||
Order the tests to start from the simplest first. This is also the
|
||||
order on the generated documentation.
|
||||
|
@ -45,6 +46,7 @@ order on the generated documentation.
|
|||
> ,postgresTests
|
||||
> ,tpchTests
|
||||
> ,sql2003Tests
|
||||
> ,sql2011Tests
|
||||
> ]
|
||||
|
||||
> tests :: Test.Framework.Test
|
||||
|
|
Loading…
Reference in a new issue