Open ghost opened 3 years ago
I also think it could be useful to expose some of the types that'd be required to mock cpal or to have some sort of virtual host for testing applications using cpal
.
Otherwise the way around it would be to add a layer and mock that.
At the moment it seems like indeed it is not possible to implement the cpal::traits
.
edit: *Thanks!
Hi
Thanks for making this library. I've hit a problem when trying to write unit tests for a function I've written that determines the best config to use for a given device. The function is generic over the
DeviceTrait
, so I started out by defining a mock struct that implementsDeviceTrait
and a mock struct that implementsIterator<Item = SupportedStreamConfigRange>
for theSupportedInputConfigs
andSupportedOutputConfigs
types. However, I can't actually create aSupportedStreamConfigRange
because it has no public constructors! Hence, I can't put dummy configs into my iterator to unit test my function.Would it be possible to provide a way to create
SupportedStreamConfigRange
s in test code or make theItem
of the iterators forSupportedInputConfigs
andSupportedOutputConfigs
on theDeviceTrait
also a an associated type so I could mock it?