diff options
Diffstat (limited to 'vendor/gix-protocol/src/handshake/refs')
-rw-r--r-- | vendor/gix-protocol/src/handshake/refs/tests.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/gix-protocol/src/handshake/refs/tests.rs b/vendor/gix-protocol/src/handshake/refs/tests.rs index a7c9171a5..7d995da5c 100644 --- a/vendor/gix-protocol/src/handshake/refs/tests.rs +++ b/vendor/gix-protocol/src/handshake/refs/tests.rs @@ -170,6 +170,20 @@ impl<'a> gix_transport::client::ReadlineBufRead for Fixture<'a> { self.0 = lines.as_bytes(); Some(Ok(Ok(gix_packetline::PacketLineRef::Data(res)))) } + + fn readline_str(&mut self, line: &mut String) -> std::io::Result<usize> { + use bstr::{BStr, ByteSlice}; + let bytes: &BStr = self.0.into(); + let mut lines = bytes.lines(); + let res = match lines.next() { + None => return Ok(0), + Some(line) => line, + }; + self.0 = lines.as_bytes(); + let len = res.len(); + line.push_str(res.to_str().expect("valid UTF8 in fixture")); + Ok(len) + } } #[cfg(feature = "async-client")] @@ -220,4 +234,17 @@ impl<'a> gix_transport::client::ReadlineBufRead for Fixture<'a> { self.0 = lines.as_bytes(); Some(Ok(Ok(gix_packetline::PacketLineRef::Data(res)))) } + async fn readline_str(&mut self, line: &mut String) -> std::io::Result<usize> { + use bstr::{BStr, ByteSlice}; + let bytes: &BStr = self.0.into(); + let mut lines = bytes.lines(); + let res = match lines.next() { + None => return Ok(0), + Some(line) => line, + }; + self.0 = lines.as_bytes(); + let len = res.len(); + line.push_str(res.to_str().expect("valid UTF8 in fixture")); + Ok(len) + } } |