diff --git a/src/main.rs b/src/main.rs index 5af09ac..2beb8b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,16 @@ mod tests; mod modules; +use std::net::{TcpListener, TcpStream, Shutdown}; + fn main() { - println!("Hello, world!"); + let listener = make_listener(String::from("localhost:5000")); + + + + drop(listener); +} + +fn make_listener(address: String) -> TcpListener { + TcpListener::bind(address).unwrap() } diff --git a/src/tests/main_tests.rs b/src/tests/main_tests.rs index da13ea1..53e8ebb 100644 --- a/src/tests/main_tests.rs +++ b/src/tests/main_tests.rs @@ -1,6 +1,14 @@ +use crate::make_listener; + #[test] fn it_works() { let result = 2 + 2; assert_eq!(result, 4); } + +#[test] +fn can_make_socket_listener(){ + let listener = make_listener(String::from("localhost:5000")); + drop(listener); +} \ No newline at end of file