Skip to content

Commit b53ca7a

Browse files
committed
Switch back to rustpkg test infrastructure
I'm not sure what the right thing to is is wrt use statements.
1 parent 1b6577e commit b53ca7a

5 files changed

Lines changed: 52 additions & 50 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/.rust/
12
/doc/
2-
/lib
3+
/test

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ install:
66
before_script:
77
- ./travis/setup.sh
88
script:
9-
- rustc --test --cfg travis -o test lib.rs
9+
- rustc --test --cfg travis test.rs
1010
- ./test

lib.rs

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -82,53 +82,50 @@ use std::rt::io::net::tcp::TcpStream;
8282
use std::task;
8383
use std::util;
8484

85-
use error::hack::PostgresSqlState;
86-
use message::{BackendMessage,
87-
AuthenticationOk,
88-
AuthenticationKerberosV5,
89-
AuthenticationCleartextPassword,
90-
AuthenticationMD5Password,
91-
AuthenticationSCMCredential,
92-
AuthenticationGSS,
93-
AuthenticationSSPI,
94-
BackendKeyData,
95-
BindComplete,
96-
CommandComplete,
97-
DataRow,
98-
EmptyQueryResponse,
99-
ErrorResponse,
100-
NoData,
101-
NoticeResponse,
102-
NotificationResponse,
103-
ParameterDescription,
104-
ParameterStatus,
105-
ParseComplete,
106-
PortalSuspended,
107-
ReadyForQuery,
108-
RowDescription};
109-
use message::{FrontendMessage,
110-
Bind,
111-
CancelRequest,
112-
Close,
113-
Describe,
114-
Execute,
115-
Parse,
116-
PasswordMessage,
117-
Query,
118-
StartupMessage,
119-
Sync,
120-
Terminate};
121-
use message::{RowDescriptionEntry, WriteMessage, ReadMessage};
122-
use types::{PostgresType, ToSql, FromSql};
85+
use self::error::hack::PostgresSqlState;
86+
use self::message::{BackendMessage,
87+
AuthenticationOk,
88+
AuthenticationKerberosV5,
89+
AuthenticationCleartextPassword,
90+
AuthenticationMD5Password,
91+
AuthenticationSCMCredential,
92+
AuthenticationGSS,
93+
AuthenticationSSPI,
94+
BackendKeyData,
95+
BindComplete,
96+
CommandComplete,
97+
DataRow,
98+
EmptyQueryResponse,
99+
ErrorResponse,
100+
NoData,
101+
NoticeResponse,
102+
NotificationResponse,
103+
ParameterDescription,
104+
ParameterStatus,
105+
ParseComplete,
106+
PortalSuspended,
107+
ReadyForQuery,
108+
RowDescription};
109+
use self::message::{FrontendMessage,
110+
Bind,
111+
CancelRequest,
112+
Close,
113+
Describe,
114+
Execute,
115+
Parse,
116+
PasswordMessage,
117+
Query,
118+
StartupMessage,
119+
Sync,
120+
Terminate};
121+
use self::message::{RowDescriptionEntry, WriteMessage, ReadMessage};
122+
use self::types::{PostgresType, ToSql, FromSql};
123123

124124
pub mod error;
125125
pub mod pool;
126126
mod message;
127127
pub mod types;
128128

129-
#[cfg(test)]
130-
mod tests;
131-
132129
static DEFAULT_PORT: Port = 5432;
133130

134131
/// Trait for types that can handle Postgres notice messages

message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::rt::io::mem::{MemWriter, MemReader};
66
use std::mem;
77
use std::vec;
88

9-
use types::Oid;
9+
use super::types::Oid;
1010

1111
pub static PROTOCOL_VERSION: i32 = 0x0003_0000;
1212
pub static CANCEL_CODE: i32 = 80877102;

tests.rs renamed to test.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[feature(struct_variant, macro_rules, globs)];
2+
13
extern mod extra;
24

35
use extra::comm::DuplexStream;
@@ -11,7 +13,7 @@ use std::f32;
1113
use std::f64;
1214
use std::rt::io::timer;
1315

14-
use super::{PostgresNoticeHandler,
16+
use lib::{PostgresNoticeHandler,
1517
PostgresNotification,
1618
DbError,
1719
DnsError,
@@ -21,13 +23,15 @@ use super::{PostgresNoticeHandler,
2123
PostgresDbError,
2224
PostgresStatement,
2325
ResultDescription};
24-
use super::error::hack::{SyntaxError,
26+
use lib::error::hack::{SyntaxError,
2527
InvalidPassword,
2628
QueryCanceled,
2729
InvalidCatalogName};
28-
use super::types::{ToSql, FromSql, PgInt4, PgVarchar};
29-
use super::types::range::{Range, Inclusive, Exclusive, RangeBound};
30-
use super::pool::PostgresConnectionPool;
30+
use lib::types::{ToSql, FromSql, PgInt4, PgVarchar};
31+
use lib::types::range::{Range, Inclusive, Exclusive, RangeBound};
32+
use lib::pool::PostgresConnectionPool;
33+
34+
mod lib;
3135

3236
#[test]
3337
// Make sure we can take both connections at once and can still get one after
@@ -563,7 +567,7 @@ fn test_cancel_query() {
563567

564568
do spawn {
565569
timer::sleep(500);
566-
assert!(super::cancel_query("postgres://postgres@localhost",
570+
assert!(lib::cancel_query("postgres://postgres@localhost",
567571
cancel_data).is_none());
568572
}
569573

0 commit comments

Comments
 (0)