From 48aaedad542b9c6cbdc85d22517cd0d151f38443 Mon Sep 17 00:00:00 2001 From: Mica White Date: Sun, 1 Dec 2024 15:28:44 -0500 Subject: Unit testing --- src/collection/owned.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/collection/owned.rs') diff --git a/src/collection/owned.rs b/src/collection/owned.rs index f2b6cc9..9aa7460 100644 --- a/src/collection/owned.rs +++ b/src/collection/owned.rs @@ -393,3 +393,20 @@ impl OwnedLockCollection { guard.key } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::Mutex; + + #[test] + fn can_be_extended() { + let mutex1 = Mutex::new(0); + let mutex2 = Mutex::new(1); + let mut collection = OwnedLockCollection::new(vec![mutex1, mutex2]); + + collection.extend([Mutex::new(2)]); + + assert_eq!(collection.data.len(), 3); + } +} -- cgit v1.2.3