Switch back to rustpkg test infrastructure

I'm not sure what the right thing to is is wrt use statements.
This commit is contained in:
Steven Fackler
2013-11-02 15:00:32 -07:00
parent 1b6577e942
commit b53ca7a47c
5 changed files with 52 additions and 50 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/.rust/
/doc/
/lib
/test

View File

@@ -6,5 +6,5 @@ install:
before_script:
- ./travis/setup.sh
script:
- rustc --test --cfg travis -o test lib.rs
- rustc --test --cfg travis test.rs
- ./test

79
lib.rs
View File

@@ -82,53 +82,50 @@ use std::rt::io::net::tcp::TcpStream;
use std::task;
use std::util;
use error::hack::PostgresSqlState;
use message::{BackendMessage,
AuthenticationOk,
AuthenticationKerberosV5,
AuthenticationCleartextPassword,
AuthenticationMD5Password,
AuthenticationSCMCredential,
AuthenticationGSS,
AuthenticationSSPI,
BackendKeyData,
BindComplete,
CommandComplete,
DataRow,
EmptyQueryResponse,
ErrorResponse,
NoData,
NoticeResponse,
NotificationResponse,
ParameterDescription,
ParameterStatus,
ParseComplete,
PortalSuspended,
ReadyForQuery,
RowDescription};
use message::{FrontendMessage,
Bind,
CancelRequest,
Close,
Describe,
Execute,
Parse,
PasswordMessage,
Query,
StartupMessage,
Sync,
Terminate};
use message::{RowDescriptionEntry, WriteMessage, ReadMessage};
use types::{PostgresType, ToSql, FromSql};
use self::error::hack::PostgresSqlState;
use self::message::{BackendMessage,
AuthenticationOk,
AuthenticationKerberosV5,
AuthenticationCleartextPassword,
AuthenticationMD5Password,
AuthenticationSCMCredential,
AuthenticationGSS,
AuthenticationSSPI,
BackendKeyData,
BindComplete,
CommandComplete,
DataRow,
EmptyQueryResponse,
ErrorResponse,
NoData,
NoticeResponse,
NotificationResponse,
ParameterDescription,
ParameterStatus,
ParseComplete,
PortalSuspended,
ReadyForQuery,
RowDescription};
use self::message::{FrontendMessage,
Bind,
CancelRequest,
Close,
Describe,
Execute,
Parse,
PasswordMessage,
Query,
StartupMessage,
Sync,
Terminate};
use self::message::{RowDescriptionEntry, WriteMessage, ReadMessage};
use self::types::{PostgresType, ToSql, FromSql};
pub mod error;
pub mod pool;
mod message;
pub mod types;
#[cfg(test)]
mod tests;
static DEFAULT_PORT: Port = 5432;
/// Trait for types that can handle Postgres notice messages

View File

@@ -6,7 +6,7 @@ use std::rt::io::mem::{MemWriter, MemReader};
use std::mem;
use std::vec;
use types::Oid;
use super::types::Oid;
pub static PROTOCOL_VERSION: i32 = 0x0003_0000;
pub static CANCEL_CODE: i32 = 80877102;

View File

@@ -1,3 +1,5 @@
#[feature(struct_variant, macro_rules, globs)];
extern mod extra;
use extra::comm::DuplexStream;
@@ -11,7 +13,7 @@ use std::f32;
use std::f64;
use std::rt::io::timer;
use super::{PostgresNoticeHandler,
use lib::{PostgresNoticeHandler,
PostgresNotification,
DbError,
DnsError,
@@ -21,13 +23,15 @@ use super::{PostgresNoticeHandler,
PostgresDbError,
PostgresStatement,
ResultDescription};
use super::error::hack::{SyntaxError,
use lib::error::hack::{SyntaxError,
InvalidPassword,
QueryCanceled,
InvalidCatalogName};
use super::types::{ToSql, FromSql, PgInt4, PgVarchar};
use super::types::range::{Range, Inclusive, Exclusive, RangeBound};
use super::pool::PostgresConnectionPool;
use lib::types::{ToSql, FromSql, PgInt4, PgVarchar};
use lib::types::range::{Range, Inclusive, Exclusive, RangeBound};
use lib::pool::PostgresConnectionPool;
mod lib;
#[test]
// Make sure we can take both connections at once and can still get one after
@@ -563,7 +567,7 @@ fn test_cancel_query() {
do spawn {
timer::sleep(500);
assert!(super::cancel_query("postgres://postgres@localhost",
assert!(lib::cancel_query("postgres://postgres@localhost",
cancel_data).is_none());
}