summaryrefslogtreecommitdiff
path: root/crates/utils/tcp_connection/tcp_connection_test/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/utils/tcp_connection/tcp_connection_test/src')
-rw-r--r--crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs12
-rw-r--r--crates/utils/tcp_connection/tcp_connection_test/src/lib.rs2
-rw-r--r--crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs13
3 files changed, 11 insertions, 16 deletions
diff --git a/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs b/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs
index 95eb5ea..cefeef0 100644
--- a/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs
+++ b/crates/utils/tcp_connection/tcp_connection_test/src/example_handle.rs
@@ -1,18 +1,14 @@
-use tokio::net::TcpStream;
use tcp_connection::handle::{ClientHandle, ServerHandle};
+use tokio::net::TcpStream;
pub(crate) struct ExampleClientHandle;
impl ClientHandle<ExampleServerHandle> for ExampleClientHandle {
- fn process(stream: TcpStream) {
-
- }
+ fn process(stream: TcpStream) {}
}
pub(crate) struct ExampleServerHandle;
impl ServerHandle<ExampleClientHandle> for ExampleServerHandle {
- fn process(stream: TcpStream) {
-
- }
-} \ No newline at end of file
+ fn process(stream: TcpStream) {}
+}
diff --git a/crates/utils/tcp_connection/tcp_connection_test/src/lib.rs b/crates/utils/tcp_connection/tcp_connection_test/src/lib.rs
index 2b72a15..697e847 100644
--- a/crates/utils/tcp_connection/tcp_connection_test/src/lib.rs
+++ b/crates/utils/tcp_connection/tcp_connection_test/src/lib.rs
@@ -1,4 +1,4 @@
#[cfg(test)]
pub mod test_tcp_target_build;
-pub(crate) mod example_handle; \ No newline at end of file
+pub(crate) mod example_handle;
diff --git a/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs b/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs
index 4ef91cb..b375671 100644
--- a/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs
+++ b/crates/utils/tcp_connection/tcp_connection_test/src/test_tcp_target_build.rs
@@ -1,14 +1,13 @@
-use tcp_connection::target::TcpServerTarget;
use crate::example_handle::{ExampleClientHandle, ExampleServerHandle};
+use tcp_connection::target::TcpServerTarget;
#[test]
fn test_tcp_test_target_build() {
-
let host = "127.0.0.1:8080";
// Test build target by string
- let Ok(target) =
- TcpServerTarget::<ExampleClientHandle, ExampleServerHandle>::from_str(host) else {
+ let Ok(target) = TcpServerTarget::<ExampleClientHandle, ExampleServerHandle>::from_str(host)
+ else {
panic!("Test target built from a target addr `{}`", host);
};
assert_eq!(target.to_string(), "127.0.0.1:8080");
@@ -16,15 +15,15 @@ fn test_tcp_test_target_build() {
#[tokio::test]
async fn test_tcp_test_target_build_domain() {
-
let host = "localhost";
// Test build target by DomainName and Connection
let Ok(target) =
- TcpServerTarget::<ExampleClientHandle, ExampleServerHandle>::from_domain(host).await else {
+ TcpServerTarget::<ExampleClientHandle, ExampleServerHandle>::from_domain(host).await
+ else {
panic!("Test target built from a domain named `{}`", host);
};
// Test into string
assert_eq!(target.to_string(), "127.0.0.1:8080");
-} \ No newline at end of file
+} default_port,