vhost-device-sound: test --socket and --socket-fd

Signed-off-by: Alyssa Ross <hi@alyssa.is>
This commit is contained in:
Alyssa Ross 2025-11-20 16:14:10 +01:00 committed by Manos Pitsidianakis
parent 3dca78e684
commit 0cd9b6bb4c

View File

@ -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(