git.iko.soy/typeable/postgresql-simple
on master help sign in
Add test/Fold.hs
2f9bf6fJoey Adams
postgresql-simple.cabal+1
@@ -80,6 +80,7 @@ test-suite test
80 Common
80 Common
81 Bytea
81 Bytea
82 ExecuteMany
82 ExecuteMany
83+ Fold
83 Notify
84 Notify
84 Serializable
85 Serializable
85 Time
86 Time
test/Fold.hsnew file+19
@@ -0,0 +1,19 @@
1+module Fold (testFold) where
2+
3+import Common
4+
5+testFold :: TestEnv -> Test
6+testFold TestEnv{..} = TestCase $ do
7+ xs <- fold_ conn "SELECT generate_series(1,10000)"
8+ [] $ \xs (Only x) -> return (x:xs)
9+ True <- return $ reverse xs == ([1..10000] :: [Int])
10+
11+ -- TODO: add more complete tests, e.g.:
12+ --
13+ -- * Fold in a transaction
14+ --
15+ -- * Fold in a transaction after a previous fold has been performed
16+ --
17+ -- * Nested fold
18+
19+ return ()
test/Main.hs+2
@@ -6,6 +6,7 @@ import System.IO
6
6
7import Bytea
7import Bytea
8import ExecuteMany
8import ExecuteMany
9+import Fold
9import Notify
10import Notify
10import Serializable
11import Serializable
11import Time
12import Time
@@ -15,6 +16,7 @@ tests =
15 [ TestLabel "Bytea" . testBytea
16 [ TestLabel "Bytea" . testBytea
16 , TestLabel "Notify" . testNotify
17 , TestLabel "Notify" . testNotify
17 , TestLabel "ExecuteMany" . testExecuteMany
18 , TestLabel "ExecuteMany" . testExecuteMany
19+ , TestLabel "Fold" . testFold
18 , TestLabel "Time" . testTime
20 , TestLabel "Time" . testTime
19 , TestLabel "Serializable" . testSerializable
21 , TestLabel "Serializable" . testSerializable
20 ]
22 ]