blob: aa1ec7466836c3b2736e15f71f98ae72e1e5d2e7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
use crate::{
test_connection::{ExampleClientHandle, ExampleServerHandle},
test_utils::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_address_str(host)
else {
panic!("Test target built failed from a target addr `{}`", host);
};
assert_eq!(target.to_string(), "127.0.0.1:8080");
}
#[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 {
panic!("Test target built failed from a domain named `{}`", host);
};
// Test into string
assert_eq!(target.to_string(), "127.0.0.1:8080");
}
|