gstreamer/meta: Don't collect iterators just to check their length in the tests

This commit is contained in:
Sebastian Dröge 2020-10-09 11:00:15 +03:00
parent f5752546fd
commit b7b29ee55a

View file

@ -426,16 +426,12 @@ mod tests {
} }
{ {
let metas = buffer.iter_meta::<Meta>().collect::<Vec<_>>(); let metas = buffer.iter_meta::<Meta>();
assert_eq!(metas.len(), 1); assert_eq!(metas.count(), 1);
} }
{ {
let metas = buffer let metas = buffer.get_mut().unwrap().iter_meta_mut::<Meta>();
.get_mut() assert_eq!(metas.count(), 1);
.unwrap()
.iter_meta_mut::<Meta>()
.collect::<Vec<_>>();
assert_eq!(metas.len(), 1);
} }
{ {
let metas = buffer.iter_meta::<ParentBufferMeta>().collect::<Vec<_>>(); let metas = buffer.iter_meta::<ParentBufferMeta>().collect::<Vec<_>>();
@ -469,28 +465,23 @@ mod tests {
} }
{ {
let metas = buffer.iter_meta::<Meta>().collect::<Vec<_>>(); let metas = buffer.iter_meta::<Meta>();
assert_eq!(metas.len(), 0); assert_eq!(metas.count(), 0);
}
{
let metas = buffer.get_mut().unwrap().iter_meta_mut::<Meta>();
assert_eq!(metas.count(), 0);
}
{
let metas = buffer.iter_meta::<ParentBufferMeta>();
assert_eq!(metas.count(), 0);
} }
{ {
let metas = buffer let metas = buffer
.get_mut() .get_mut()
.unwrap() .unwrap()
.iter_meta_mut::<Meta>() .iter_meta_mut::<ParentBufferMeta>();
.collect::<Vec<_>>(); assert_eq!(metas.count(), 0);
assert_eq!(metas.len(), 0);
}
{
let metas = buffer.iter_meta::<ParentBufferMeta>().collect::<Vec<_>>();
assert_eq!(metas.len(), 0);
}
{
let metas = buffer
.get_mut()
.unwrap()
.iter_meta_mut::<ParentBufferMeta>()
.collect::<Vec<_>>();
assert_eq!(metas.len(), 0);
} }
assert!(buffer.get_meta::<ParentBufferMeta>().is_none()); assert!(buffer.get_meta::<ParentBufferMeta>().is_none());