diff --git a/vhost-device-sound/src/main.rs b/vhost-device-sound/src/main.rs index 3dcfd29..2d4c4df 100644 --- a/vhost-device-sound/src/main.rs +++ b/vhost-device-sound/src/main.rs @@ -33,10 +33,29 @@ fn main() { mod tests { use clap::Parser; use rstest::*; + use std::path::PathBuf; use vhost_device_sound::BackendType; use super::*; + #[test] + fn test_cli_socket_arg() { + let args: SoundArgs = Parser::parse_from([ + "", + "--socket", + "/tmp/vhost-sound.socket", + "--backend", + "null", + ]); + assert_eq!(args.socket, Some(PathBuf::from("/tmp/vhost-sound.socket"))); + } + + #[test] + fn test_cli_socket_fd_arg() { + let args: SoundArgs = Parser::parse_from(["", "--socket-fd", "3", "--backend", "null"]); + assert_eq!(args.socket_fd, Some(3)); + } + #[rstest] #[case::null_backend("null", BackendType::Null)] #[cfg_attr(