-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[git-packetline] the first very failing test…
…and the beginning of something wonderful: implementations of poll_* of futures.
- Loading branch information
Showing
7 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
#[cfg(all(feature = "async-io", not(feature = "blocking-io")))] | ||
#[test] | ||
fn to_be_done() { | ||
assert!(true) | ||
} | ||
mod async_io; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod write; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use bstr::ByteSlice; | ||
use futures_io::AsyncWrite; | ||
use futures_lite::{future, prelude::*}; | ||
use git_packetline::Writer; | ||
|
||
// | ||
// const MAX_DATA_LEN: usize = 65516; | ||
// const MAX_LINE_LEN: usize = 4 + MAX_DATA_LEN; | ||
// | ||
// #[test] | ||
// fn each_write_results_in_one_line() -> crate::Result { | ||
// let mut w = Writer::new(Vec::new()); | ||
// w.write_all(b"hello")?; | ||
// w.write(b"world!")?; | ||
// assert_eq!(w.inner.as_bstr(), b"0009hello000aworld!".as_bstr()); | ||
// Ok(()) | ||
// } | ||
// | ||
// #[test] | ||
// fn write_text_and_write_binary() -> crate::Result { | ||
// let mut w = Writer::new(Vec::new()).text_mode(); | ||
// w.write_all(b"hello")?; | ||
// w = w.binary_mode(); | ||
// w.write(b"world")?; | ||
// assert_eq!(w.inner.as_bstr(), b"000ahello\n0009world".as_bstr()); | ||
// Ok(()) | ||
// } | ||
// | ||
// #[test] | ||
// fn huge_writes_are_split_into_lines() -> crate::Result { | ||
// let data = { | ||
// let mut v = Vec::new(); | ||
// v.resize(MAX_DATA_LEN * 2, 0); | ||
// v | ||
// }; | ||
// let mut w = Writer::new(Vec::new()); | ||
// w.write(&data)?; | ||
// assert_eq!(w.inner.len(), MAX_LINE_LEN * 2); | ||
// Ok(()) | ||
// } | ||
// | ||
#[test] | ||
fn empty_writes_fail_with_error() { | ||
assert_eq!( | ||
future::block_on(async { Writer::new(Vec::new()).write(&[]).await.unwrap_err().to_string() }), | ||
"empty packet lines are not permitted as '0004' is invalid" | ||
); | ||
} | ||
// | ||
// #[test] | ||
// fn nothing_happens_on_into_read() { | ||
// let mut out = Vec::new(); | ||
// let w = Writer::new(&mut out); | ||
// drop(w); | ||
// assert!(out.is_empty()); | ||
// } |
File renamed without changes.