Add Windows path test

This commit is contained in:
altugbakan 2023-03-11 20:54:29 +03:00
parent a3dd7fecb4
commit 4e77ecadc0

View file

@ -88,6 +88,20 @@ mod tests {
assert_eq!(config.directory, PathBuf::from_str("/").unwrap()); 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] #[test]
fn parses_some_config() { fn parses_some_config() {
let config = Config::new( let config = Config::new(