Make tests OS independent
This commit is contained in:
parent
66f479e8bc
commit
6e52f55264
3 changed files with 3 additions and 17 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue