Skip to content

Commit 069538c

Browse files
committed
refactor tsets
1 parent ffa54bb commit 069538c

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/test_utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,20 @@ pub(crate) fn create_result_connected() -> (
180180
}
181181

182182
#[cfg(test)]
183-
mod test_test_utils {
184-
use super::*;
185-
use futures::SinkExt;
183+
mod test {
184+
#![allow(unused_imports)] // test's within tests confused clippy
185+
use futures::{SinkExt, StreamExt};
186186
#[tokio::test]
187187
async fn way_one() {
188-
let mut a = Io::default();
188+
let mut a = super::Io::default();
189189
let _ = a.send(b"hello".into()).await;
190190
let Some(res) = a.next().await else { panic!() };
191191
assert_eq!(res, b"hello");
192192
}
193193

194194
#[tokio::test]
195195
async fn split() {
196-
let (mut left, mut right) = (TwoWay::default()).split_sides();
196+
let (mut left, mut right) = (super::TwoWay::default()).split_sides();
197197
left.send(b"hello".to_vec()).await.unwrap();
198198
let Some(res) = right.next().await else {
199199
panic!();

tests/js_interop.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
pub mod _util;
12
#[path = "../src/test_utils.rs"]
23
mod test_utils;
4+
35
use _util::wait_for_localhost_port;
46
use anyhow::Result;
7+
#[cfg(feature = "tokio")]
8+
use async_compat::CompatExt;
59
use futures::Future;
610
use futures_lite::stream::StreamExt;
711
use hypercore::{
@@ -14,9 +18,6 @@ use std::{
1418
path::Path,
1519
sync::{Arc, Once},
1620
};
17-
18-
#[cfg(feature = "tokio")]
19-
use async_compat::CompatExt;
2021
#[cfg(feature = "tokio")]
2122
use tokio::{
2223
fs::{metadata, File},
@@ -29,7 +30,6 @@ use tokio::{
2930

3031
use hypercore_protocol::{discovery_key, schema::*, Channel, Event, Message, ProtocolBuilder};
3132

32-
pub mod _util;
3333
mod js;
3434
use js::{cleanup, install, js_run_client, js_start_server, prepare_test_set};
3535

@@ -40,6 +40,7 @@ fn init() {
4040
cleanup();
4141
install();
4242
});
43+
test_utils::log();
4344
}
4445

4546
const TEST_SET_NODE_CLIENT_NODE_SERVER: &str = "ncns";

0 commit comments

Comments
 (0)