mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-28 15:22:30 +01:00
Rename client_stubs => client_methods. Modify unit test to check for the Error variant returned on shutdown.
This commit is contained in:
@@ -4,7 +4,7 @@ macro_rules! as_item { ($i:item) => {$i} }
|
||||
// Required because if-let can't be used with irrefutable patterns, so it needs
|
||||
// to be special cased.
|
||||
#[macro_export]
|
||||
macro_rules! client_stubs {
|
||||
macro_rules! client_methods {
|
||||
(
|
||||
{ $(#[$attr:meta])* }
|
||||
$fn_name:ident( $( $arg:ident : $in_:ty ),* ) -> $out:ty
|
||||
@@ -140,7 +140,7 @@ macro_rules! rpc {
|
||||
Ok(Client(inner))
|
||||
}
|
||||
|
||||
client_stubs!(
|
||||
client_methods!(
|
||||
$(
|
||||
{ $(#[$attr])* }
|
||||
$fn_name($($arg: $in_),*) -> $out
|
||||
|
||||
@@ -561,7 +561,14 @@ mod test {
|
||||
let addr = serve_handle.local_addr().clone();
|
||||
let client: Arc<Client<Request, Reply>> = Arc::new(Client::new(addr, None).unwrap());
|
||||
serve_handle.shutdown();
|
||||
let _ = client.rpc(&Request::Increment); // First failure will trigger reader to shutdown
|
||||
match client.rpc(&Request::Increment) {
|
||||
ok @ Ok(_) => panic!("Expected Err, got {:?}", ok),
|
||||
Err(e) => if let super::Error::ConnectionBroken = e {
|
||||
/* success */
|
||||
} else {
|
||||
panic!("Expected Error::ConnectionBroken, got {:?}", e);
|
||||
},
|
||||
}
|
||||
let _ = client.rpc(&Request::Increment); // Test whether second failure hangs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user