git.iko.soy/typeable/postgresql-simple
on master help sign in
Improve test case for COPY OUT
6182abcLeon P Smith
test/Main.hs+6−2
@@ -287,11 +287,15 @@ testCopy TestEnv{..} = TestCase $ do
287 copy_ conn "COPY copy_test FROM STDIN (FORMAT CSV)"
287 copy_ conn "COPY copy_test FROM STDIN (FORMAT CSV)"
288 mapM_ (putCopyData conn) abortRows
288 mapM_ (putCopyData conn) abortRows
289 putCopyError conn "aborted"
289 putCopyError conn "aborted"
290− copy_ conn "COPY copy_test TO STDOUT (FORMAT CSV)"
291− rows <- loop []
292 -- Hmm, does postgres always produce \n as an end-of-line here, or
290 -- Hmm, does postgres always produce \n as an end-of-line here, or
293 -- are there cases where it will use a \r\n as well?
291 -- are there cases where it will use a \r\n as well?
292+ copy_ conn "COPY copy_test TO STDOUT (FORMAT CSV)"
293+ rows <- loop []
294 sort rows @?= sort copyRows
294 sort rows @?= sort copyRows
295+ -- Now, let's just verify that the connection state is back to ready,
296+ -- so that we can issue more queries:
297+ [Only (x::Int)] <- query_ conn "SELECT 2 + 2"
298+ x @?= 4
295 where
299 where
296 copyRows = ["1,foo\n"
300 copyRows = ["1,foo\n"
297 ,"2,bar\n"]
301 ,"2,bar\n"]