Skip to content

Commit b52c91e

Browse files
committed
clean up test_utils
1 parent df6d311 commit b52c91e

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

src/noise.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ where
318318
}
319319
Ok(vec![])
320320
}
321-
Step::Established((..)) => todo!(),
321+
Step::Established(_) => {
322+
unreachable!("`handle_setup_message` should never be called when Step::Established")
323+
}
322324
}
323325
}
324326
#[instrument(skip_all)]

src/test_utils.rs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -97,27 +97,6 @@ pub(crate) fn log() {
9797
});
9898
}
9999

100-
#[tokio::test]
101-
async fn way_one() {
102-
use futures::SinkExt;
103-
let mut a = Io::default();
104-
let _ = a.send(b"hello".into()).await;
105-
let Some(res) = a.next().await else { panic!() };
106-
assert_eq!(res, b"hello");
107-
}
108-
109-
#[tokio::test]
110-
async fn split() {
111-
use futures::SinkExt;
112-
let (mut left, mut right) = (TwoWay::default()).split_sides();
113-
114-
left.send(b"hello".to_vec()).await.unwrap();
115-
let Some(res) = right.next().await else {
116-
panic!();
117-
};
118-
assert_eq!(res, b"hello");
119-
}
120-
121100
pub(crate) struct Moo<Rx, Tx> {
122101
receiver: Rx,
123102
sender: Tx,
@@ -199,3 +178,26 @@ pub(crate) fn create_result_connected() -> (
199178
let b = Moo::from(result_channel());
200179
a.connect(b)
201180
}
181+
182+
#[cfg(test)]
183+
mod test_test_utils {
184+
use super::*;
185+
use futures::SinkExt;
186+
#[tokio::test]
187+
async fn way_one() {
188+
let mut a = Io::default();
189+
let _ = a.send(b"hello".into()).await;
190+
let Some(res) = a.next().await else { panic!() };
191+
assert_eq!(res, b"hello");
192+
}
193+
194+
#[tokio::test]
195+
async fn split() {
196+
let (mut left, mut right) = (TwoWay::default()).split_sides();
197+
left.send(b"hello".to_vec()).await.unwrap();
198+
let Some(res) = right.next().await else {
199+
panic!();
200+
};
201+
assert_eq!(res, b"hello");
202+
}
203+
}

0 commit comments

Comments
 (0)