diff --git a/.gitignore b/.gitignore index f3b56444..1472b383 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ -/.rust/ -/build/ -/bin/ /doc/ -/lib/ +/lib diff --git a/tests.rs b/tests.rs index 72ce3c52..037dee30 100644 --- a/tests.rs +++ b/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");