Created
April 17, 2017 10:12
-
-
Save allengeorge/1b6f004a4bc3bc29c13f8706df81c610 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To learn more, run the command again with --verbose. | |
| allen@mrwiggles ~/s/r/t/l/rs> cargo test | |
| Compiling thrift v1.0.0 (file:///Users/allen/src/rust_projects/thrift/lib/rs) | |
| error[E0308]: mismatched types | |
| --> src/protocol/multiplexed.rs:200:16 | |
| | | |
| 200 | mem_fn(&mut chan, |c| assert_eq!(c.write_bytes(), &expected)); | |
| | ^^^^^^^^^ expected trait transport::TIOChannel, found struct `transport::mem::TBufferChannel` | |
| | | |
| = note: expected type `&mut std::boxed::Box<transport::TIOChannel + 'static>` | |
| found type `&mut std::boxed::Box<transport::mem::TBufferChannel>` | |
| error: aborting due to previous error | |
| error: Could not compile `thrift`. | |
| Build failed, waiting for other jobs to finish... | |
| error: build failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[cfg(test)] | |
| mod tests { | |
| use ::protocol::{TBinaryOutputProtocol, TMessageIdentifier, TMessageType, TOutputProtocol}; | |
| use ::transport::{TIOChannel, TPassThruTransport}; | |
| use ::transport::mem::{mem_fn, TBufferChannel}; | |
| use super::*; | |
| #[test] | |
| fn must_write_message_begin_with_prefixed_service_name() { | |
| let (mut chan, mut o_prot) = test_objects(); | |
| let ident = TMessageIdentifier::new("bar", TMessageType::Call, 2); | |
| assert_success!(o_prot.write_message_begin(&ident)); | |
| let expected: [u8; 19] = | |
| [0x80, 0x01 /* protocol identifier */, 0x00, 0x01 /* message type */, 0x00, | |
| 0x00, 0x00, 0x07, 0x66, 0x6F, 0x6F /* "foo" */, 0x3A /* ":" */, 0x62, 0x61, | |
| 0x72 /* "bar" */, 0x00, 0x00, 0x00, 0x02 /* sequence number */]; | |
| mem_fn(&mut chan, |c| assert_eq!(c.write_bytes(), &expected)); | |
| } | |
| fn test_objects<'a>() -> (Box<TBufferChannel>, TMultiplexedOutputProtocol<'a>) { | |
| let chan_0 = TBufferChannel::with_capacity(40, 40); | |
| let chan_1 = chan_0.try_clone().unwrap(); | |
| let tran = TPassThruTransport::new(Box::new(chan_1)); | |
| let prot = TBinaryOutputProtocol::new(Box::new(tran), true); | |
| (Box::new(chan_0), TMultiplexedOutputProtocol::new("foo", Box::new(prot))) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment