Skip to content

Commit 186056e

Browse files
committed
In terminal type test don't assume all streams have the right direction
For input there could be a an output stream if vpio is present on the machine.
1 parent b3fc2a1 commit 186056e

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/backend/tests/device_property.rs

+8-16
Original file line numberDiff line numberDiff line change
@@ -501,28 +501,20 @@ fn test_get_stream_terminal_type() {
501501
}
502502
if let Some(device) = test_get_default_device(Scope::Input) {
503503
let streams = run_serially(|| get_device_streams(device, DeviceType::INPUT)).unwrap();
504-
for stream in streams {
505-
assert_eq!(
506-
terminal_type_to_device_type(
507-
run_serially(|| get_stream_terminal_type(stream)).unwrap()
508-
),
509-
Some(DeviceType::INPUT)
510-
);
511-
}
504+
assert!(streams.iter().any(|&s| {
505+
terminal_type_to_device_type(run_serially(|| get_stream_terminal_type(s)).unwrap())
506+
== Some(DeviceType::INPUT)
507+
}));
512508
} else {
513509
println!("No input device.");
514510
}
515511

516512
if let Some(device) = test_get_default_device(Scope::Output) {
517513
let streams = run_serially(|| get_device_streams(device, DeviceType::OUTPUT)).unwrap();
518-
for stream in streams {
519-
assert_eq!(
520-
terminal_type_to_device_type(
521-
run_serially(|| get_stream_terminal_type(stream)).unwrap()
522-
),
523-
Some(DeviceType::OUTPUT)
524-
);
525-
}
514+
assert!(streams.iter().any(|&s| {
515+
terminal_type_to_device_type(run_serially(|| get_stream_terminal_type(s)).unwrap())
516+
== Some(DeviceType::OUTPUT)
517+
}));
526518
} else {
527519
println!("No output device.");
528520
}

0 commit comments

Comments
 (0)