Skip to content

Commit b26c43b

Browse files
committed
[git-packetline] fix tests
1 parent 1a986fb commit b26c43b

File tree

7 files changed

+13
-21
lines changed

7 files changed

+13
-21
lines changed

git-packetline/Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ serde1 = ["serde", "bstr/serde1"]
1717
async-io = ["futures-io", "pin-project-lite"]
1818
blocking-io = []
1919

20-
[[test]]
21-
name = "non-io-packetline"
22-
path = "tests/common-packetline.rs"
23-
required-features = []
24-
2520
[[test]]
2621
name = "async-packetline"
2722
path = "tests/async-packetline.rs"

git-packetline/src/encode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ mod blocking_io {
9696
#[cfg(feature = "blocking-io")]
9797
pub use blocking_io::*;
9898

99+
#[cfg(any(feature = "async-io", feature = "blocking-io"))]
99100
pub(crate) fn u16_to_hex(value: u16) -> [u8; 4] {
100101
let mut buf = [0u8; 4];
101102
hex::encode_to_slice((value as u16).to_be_bytes(), &mut buf).expect("two bytes to 4 hex chars never fails");
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
pub type Result = std::result::Result<(), Box<dyn std::error::Error>>;
22

3+
pub fn assert_err_display<T: std::fmt::Debug, E: std::error::Error>(
4+
res: std::result::Result<T, E>,
5+
expected: impl AsRef<str>,
6+
) {
7+
match res {
8+
Ok(v) => assert!(false, "Expected error '{}', got value {:?}", expected.as_ref(), v),
9+
Err(err) => assert_eq!(err.to_string(), expected.as_ref()),
10+
}
11+
}
12+
313
#[cfg(feature = "blocking-io")]
414
mod blocking;
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
mod decode;
2+
mod encode;
13
mod read;
24
mod write;

git-packetline/tests/common-packetline.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)