From 0cd9b6bb4c7258e8b8164caf23cb89e3d5d0a4b4 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 20 Nov 2025 16:14:10 +0100 Subject: [PATCH] vhost-device-sound: test --socket and --socket-fd Signed-off-by: Alyssa Ross --- vhost-device-sound/src/main.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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(