From be7eb63d1ccec2ddd284767970e4fff219f9f54d Mon Sep 17 00:00:00 2001 From: NikVolf Date: Tue, 12 Apr 2016 06:43:45 +0300 Subject: [PATCH] handshake dispatch test --- ipc/tests/examples.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ipc/tests/examples.rs b/ipc/tests/examples.rs index 202139d54..9a5158830 100644 --- a/ipc/tests/examples.rs +++ b/ipc/tests/examples.rs @@ -35,6 +35,30 @@ mod tests { assert_eq!(10, *service.commits.read().unwrap()); } + + #[test] + fn call_service_handshake() { + let mut socket = TestSocket::new_ready(vec![0, 0, + // protocol version + 0, 0, 0, 0, 0, 0, 0, 5, b'1', b'.', b'0', b'.', b'0', + // api version + 0, 0, 0, 0, 0, 0, 0, 5, b'1', b'.', b'0', b'.', b'0', + // reserved + 0, 0, 0, 0, 0, 0, 0, 64, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ]); + + let service = Service::new(); + let result = service.dispatch(&mut socket); + + // single `true` + assert_eq!(vec![1], result); + } + + #[test] fn call_service_proxy() { let mut socket = TestSocket::new();