[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] postgresql tests/run.scm line 17 ff.
From: |
Herr |
Subject: |
[Chicken-users] postgresql tests/run.scm line 17 ff. |
Date: |
Sun, 03 Mar 2013 00:05:34 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 |
Hi,
I looked at the tests to learn something about scheme and the postgresql
interface.
The following does not look good:
(test-assert "reset-connection returns a connection"
(let* ((conn (connect '((dbname . test))))
(isconn (connection? conn)))
(reset-connection conn)
(disconnect conn)
isconn))
(test-error "disconnect invalidates the connection"
(let ((conn (connect '((dbname . test)))))
(disconnect conn)
(reset-connection conn)))
I suppose in the first test you want to test if the connection is still alive
after
reset-connection, but you only test after connect. Proposed changes: replace
test
last line isconn with (connection? conn)
In the second test the return value is from reset-connection, which is problably
void. Proposed change: replace (reset-connection conn) with (connection? conn).
Then you will notice that the test fails.
I checked this in the REPL: after (disconnect conn) I still got true for
(connection?
conn) but was not able to use it for queries.
Terminal-Log to this problem:
#;11> (disconnect conn)
#;12> (connection? conn)
#t
#;13> (value-at (query conn "select -101 as cnt"))
Error: (query*) Unable to send query to server. connection pointer is NULL
/Str.
- [Chicken-users] postgresql tests/run.scm line 17 ff.,
Herr <=
- Re: [Chicken-users] postgresql tests/run.scm line 17 ff., Peter Bex, 2013/03/03
- Re: [Chicken-users] postgresql tests/run.scm line 17 ff., Herr, 2013/03/03
- Re: [Chicken-users] postgresql tests/run.scm line 17 ff., Peter Bex, 2013/03/03
- Re: [Chicken-users] postgresql tests/run.scm line 17 ff., Herr, 2013/03/03
- Re: [Chicken-users] postgresql tests/run.scm line 17 ff., Peter Bex, 2013/03/03
- Re: [Chicken-users] postgresql tests/run.scm line 17 ff., Herr, 2013/03/03
- Re: [Chicken-users] postgresql tests/run.scm line 17 ff., Herr, 2013/03/03