-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit testing seems to be difficult #27
Comments
It's possible to turn your Lines 823 to 834 in 6985960
Does that work for you? |
Thanks @dwrensha. That snippet allowed me to construct this simple testcase, although I haven't yet grasped what is happening internally. #[test]
fn proxy_server_hello() {
let client =
::proxy_capnp::proxy::ToClient::new(Proxy {}).from_server::<::capnp_rpc::Server>();
let mut request = client.hello_request();
request.get().set_name("Proxy");
let response = request.send().promise.wait().unwrap();
assert_eq!(
response.get().unwrap().get_greetings().unwrap(),
"Hello Proxy"
);
} Is there a document where the mechanics of client/server is described? If not, since it's not self-explanatory I'm happy to help build some beginner friendly docs. |
I think the important thing to remember is: a The main documentation we have for this stuff right now is in the README.md at the root of the capnp-rpc-rust repo. That could certainly be expanded upon. |
I've just gotten started using this crate and I'm struggling with something rather simple.
Here's a snippet of my code, which is supposed to build a greeting message:
I would like to write a unit test for this, but no matter which approach I try it seems too difficult to immitate capnp's internals. I'd be happy about any pointers on how to approach this, or if someone could point out any mistakes I've already made ;-)
The text was updated successfully, but these errors were encountered: