Define Transport trait, TransportAcceptor trait, TransportInfo, and TransportKind types
This commit is contained in:
2
crates/wraith-core/tests/auth_tests.rs
Normal file
2
crates/wraith-core/tests/auth_tests.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
#[tokio::test]
|
||||
async fn auth_placeholder() {}
|
||||
2
crates/wraith-core/tests/client_tests.rs
Normal file
2
crates/wraith-core/tests/client_tests.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
#[tokio::test]
|
||||
async fn client_placeholder() {}
|
||||
2
crates/wraith-core/tests/server_tests.rs
Normal file
2
crates/wraith-core/tests/server_tests.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
#[tokio::test]
|
||||
async fn server_placeholder() {}
|
||||
26
crates/wraith-core/tests/transport_tests.rs
Normal file
26
crates/wraith-core/tests/transport_tests.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use wraith_core::testutil::{MockTransport, MockTransportAcceptor, Transport, TransportAcceptor, mock_pair};
|
||||
|
||||
#[tokio::test]
|
||||
async fn mock_transport_connect() {
|
||||
let transport = MockTransport::new(1024);
|
||||
let stream = transport.connect().await.unwrap();
|
||||
drop(stream);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn mock_transport_acceptor_accept() {
|
||||
let acceptor = MockTransportAcceptor::new(1024);
|
||||
let (stream, info) = acceptor.accept().await.unwrap();
|
||||
drop(stream);
|
||||
drop(info);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn mock_pair_communicates() {
|
||||
let (mut client, mut server) = mock_pair(1024);
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
client.write_all(b"hello").await.unwrap();
|
||||
let mut buf = [0u8; 5];
|
||||
server.read_exact(&mut buf).await.unwrap();
|
||||
assert_eq!(&buf, b"hello");
|
||||
}
|
||||
Reference in New Issue
Block a user