From 6e52f55264367b40f738dd00dc6ecae3454ee3ef Mon Sep 17 00:00:00 2001 From: altugbakan Date: Mon, 13 Mar 2023 20:08:37 +0300 Subject: [PATCH] Make tests OS independent --- src/config.rs | 14 -------------- src/message.rs | 2 +- src/server.rs | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/config.rs b/src/config.rs index 3c6ca63..b81b1ae 100644 --- a/src/config.rs +++ b/src/config.rs @@ -108,20 +108,6 @@ mod tests { assert_eq!(config.directory, PathBuf::from_str("/").unwrap()); } - #[test] - fn parses_windows_config() { - let config = Config::new( - vec!["/", "-i", "127.0.0.1", "-d", r"C:\Users\", "-p", "1567"] - .iter() - .map(|s| s.to_string()), - ) - .unwrap(); - - assert_eq!(config.ip_address, Ipv4Addr::new(127, 0, 0, 1)); - assert_eq!(config.port, 1567); - assert_eq!(config.directory, PathBuf::from_str(r"C:\Users\").unwrap()); - } - #[test] fn parses_some_config() { let config = Config::new( diff --git a/src/message.rs b/src/message.rs index 921cf88..0ab0650 100644 --- a/src/message.rs +++ b/src/message.rs @@ -16,7 +16,7 @@ use crate::{ErrorCode, Packet, TransferOption}; /// /// // Send a FileNotFound error. /// Message::send_error_to( -/// &UdpSocket::bind(SocketAddr::from_str("127.0.0.1:69").unwrap()).unwrap(), +/// &UdpSocket::bind(SocketAddr::from_str("127.0.0.1:6969").unwrap()).unwrap(), /// &SocketAddr::from_str("127.0.0.1:1234").unwrap(), /// ErrorCode::FileNotFound, /// "file does not exist".to_string(), diff --git a/src/server.rs b/src/server.rs index 9d359e4..f28e899 100644 --- a/src/server.rs +++ b/src/server.rs @@ -13,10 +13,10 @@ use std::path::PathBuf; /// /// ```rust /// // Create the TFTP server. -/// use std::env; /// use tftpd::{Config, Server}; /// -/// let config = Config::new(env::args()).unwrap(); +/// let args = ["/", "-p", "1234"].iter().map(|s| s.to_string()); +/// let config = Config::new(args).unwrap(); /// let server = Server::new(&config).unwrap(); /// ``` pub struct Server {