Add a couple of tests

This commit is contained in:
Steven Fackler
2013-10-24 22:01:40 -07:00
parent 674e520840
commit 35c3be0ac8
2 changed files with 18 additions and 5 deletions

5
.gitignore vendored
View File

@@ -1,5 +1,2 @@
/.rust/
/build/
/bin/
/doc/
/lib/
/lib

View File

@@ -21,7 +21,10 @@ use super::{PostgresNoticeHandler,
PostgresDbError,
PostgresStatement,
ResultDescription};
use super::error::hack::{SyntaxError, InvalidPassword, QueryCanceled};
use super::error::hack::{SyntaxError,
InvalidPassword,
QueryCanceled,
InvalidCatalogName};
use super::types::{ToSql, FromSql, PgInt4, PgVarchar};
use super::pool::PostgresConnectionPool;
@@ -55,6 +58,11 @@ fn test_non_default_database() {
PostgresConnection::connect("postgres://postgres@localhost/postgres");
}
#[test]
fn test_url_terminating_slash() {
PostgresConnection::connect("postgres://postgres@localhost/");
}
#[test]
fn test_prepare_err() {
let conn = PostgresConnection::connect("postgres://postgres@localhost");
@@ -64,6 +72,14 @@ fn test_prepare_err() {
}
}
#[test]
fn test_unknown_database() {
match PostgresConnection::try_connect("postgres://postgres@localhost/asdf") {
Err(DbError(PostgresDbError { code: InvalidCatalogName, _ })) => {}
resp => fail!("Unexpected result {:?}", resp)
}
}
#[test]
fn test_transaction_commit() {
let conn = PostgresConnection::connect("postgres://postgres@localhost");