mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-24 19:50:21 +01:00
Create temp file using tempdir in test
This commit is contained in:
@@ -20,3 +20,4 @@ unix_socket = "^0.5.0"
|
||||
[dev-dependencies]
|
||||
lazy_static = "^0.1.15"
|
||||
env_logger = "^0.3.2"
|
||||
tempdir = "^0.3.4"
|
||||
|
||||
@@ -522,6 +522,7 @@ mod syntax_test {
|
||||
#[cfg(test)]
|
||||
mod functional_test {
|
||||
extern crate env_logger;
|
||||
extern crate tempdir;
|
||||
use Config;
|
||||
use transport::unix::UnixTransport;
|
||||
|
||||
@@ -583,16 +584,15 @@ mod functional_test {
|
||||
|
||||
#[test]
|
||||
fn async_try_clone_unix() {
|
||||
let handle = Server.spawn_with_config(UnixTransport("/tmp/test"),
|
||||
let temp_dir = tempdir::TempDir::new(module_path!()).unwrap();
|
||||
let temp_file = temp_dir.path().join("async_try_clone_unix.tmp");
|
||||
let handle = Server.spawn_with_config(UnixTransport(temp_file),
|
||||
Config::default()).unwrap();
|
||||
let client1 = AsyncClient::with_config(handle.dialer(),
|
||||
Config::default()).unwrap();
|
||||
let client2 = client1.try_clone().unwrap();
|
||||
assert_eq!(3, client1.add(1, 2).get().unwrap());
|
||||
assert_eq!(3, client2.add(1, 2).get().unwrap());
|
||||
drop(client1);
|
||||
drop(client2);
|
||||
handle.shutdown();
|
||||
}
|
||||
|
||||
// Tests that a server can be wrapped in an Arc; no need to run, just compile
|
||||
|
||||
Reference in New Issue
Block a user