Add a couple of tests
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +1,2 @@
|
||||
/.rust/
|
||||
/build/
|
||||
/bin/
|
||||
/doc/
|
||||
/lib/
|
||||
/lib
|
||||
|
||||
18
tests.rs
18
tests.rs
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user