fix tests generating an extra blank Txn for each server
This commit is contained in:
@@ -25,7 +25,8 @@ fn test_redirect_301_and_302_and_303_changes_post_to_get() {
|
|||||||
Location: /dst\r\n\
|
Location: /dst\r\n\
|
||||||
Connection: close\r\n\
|
Connection: close\r\n\
|
||||||
\r\n\
|
\r\n\
|
||||||
", code),
|
", code)
|
||||||
|
;
|
||||||
|
|
||||||
request: format!("\
|
request: format!("\
|
||||||
GET /dst HTTP/1.1\r\n\
|
GET /dst HTTP/1.1\r\n\
|
||||||
@@ -76,7 +77,8 @@ fn test_redirect_307_and_308_tries_to_get_again() {
|
|||||||
Location: /dst\r\n\
|
Location: /dst\r\n\
|
||||||
Connection: close\r\n\
|
Connection: close\r\n\
|
||||||
\r\n\
|
\r\n\
|
||||||
", code),
|
", code)
|
||||||
|
;
|
||||||
|
|
||||||
request: format!("\
|
request: format!("\
|
||||||
GET /dst HTTP/1.1\r\n\
|
GET /dst HTTP/1.1\r\n\
|
||||||
@@ -129,7 +131,8 @@ fn test_redirect_307_and_308_tries_to_post_again() {
|
|||||||
Location: /dst\r\n\
|
Location: /dst\r\n\
|
||||||
Connection: close\r\n\
|
Connection: close\r\n\
|
||||||
\r\n\
|
\r\n\
|
||||||
", code),
|
", code)
|
||||||
|
;
|
||||||
|
|
||||||
request: format!("\
|
request: format!("\
|
||||||
POST /dst HTTP/1.1\r\n\
|
POST /dst HTTP/1.1\r\n\
|
||||||
@@ -328,7 +331,8 @@ fn test_referer_is_not_set_if_disabled() {
|
|||||||
Location: /dst\r\n\
|
Location: /dst\r\n\
|
||||||
Connection: close\r\n\
|
Connection: close\r\n\
|
||||||
\r\n\
|
\r\n\
|
||||||
",
|
"
|
||||||
|
;
|
||||||
|
|
||||||
request: b"\
|
request: b"\
|
||||||
GET /dst HTTP/1.1\r\n\
|
GET /dst HTTP/1.1\r\n\
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ impl Drop for Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Txn {
|
pub struct Txn {
|
||||||
pub request: Vec<u8>,
|
pub request: Vec<u8>,
|
||||||
pub response: Vec<u8>,
|
pub response: Vec<u8>,
|
||||||
@@ -188,13 +188,10 @@ fn replace_expected_vars(bytes: &mut Vec<u8>, host: &[u8], ua: &[u8]) {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! server {
|
macro_rules! server {
|
||||||
($(request: $req:expr, response: $res:expr),*) => ({
|
($($($f:ident: $v:expr),+);*) => ({
|
||||||
server!($(request: $req, response: $res;)*)
|
|
||||||
});
|
|
||||||
($($($f:ident: $v:expr),*);*) => ({
|
|
||||||
let txns = vec![
|
let txns = vec![
|
||||||
$(__internal__txn! {
|
$(__internal__txn! {
|
||||||
$($f: $v,)*
|
$($f: $v,)+
|
||||||
}),*
|
}),*
|
||||||
];
|
];
|
||||||
::support::server::spawn(txns)
|
::support::server::spawn(txns)
|
||||||
@@ -203,9 +200,9 @@ macro_rules! server {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! __internal__txn {
|
macro_rules! __internal__txn {
|
||||||
($($field:ident: $val:expr,)*) => (
|
($($field:ident: $val:expr,)+) => (
|
||||||
::support::server::Txn {
|
::support::server::Txn {
|
||||||
$( $field: __internal__prop!($field: $val), )*
|
$( $field: __internal__prop!($field: $val), )+
|
||||||
.. Default::default()
|
.. Default::default()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user