summaryrefslogtreecommitdiff
path: root/src/collection/owned.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2025-03-16 19:34:17 -0400
committerBotahamec <botahamec@outlook.com>2025-03-16 19:34:17 -0400
commit3a299432173f98521d0aeb840dafb6710ce27f82 (patch)
treeca49aeec2b817b18df14e3e6e975d3f76943801d /src/collection/owned.rs
parent95ff1eb39dd7806ed3066a299e975afd72d89951 (diff)
Add test for owned lock in lock collection
Diffstat (limited to 'src/collection/owned.rs')
-rw-r--r--src/collection/owned.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/collection/owned.rs b/src/collection/owned.rs
index 866d778..38e6a16 100644
--- a/src/collection/owned.rs
+++ b/src/collection/owned.rs
@@ -503,7 +503,7 @@ impl<L: LockableIntoInner> OwnedLockCollection<L> {
#[cfg(test)]
mod tests {
use super::*;
- use crate::{Mutex, RwLock, ThreadKey};
+ use crate::{LockCollection, Mutex, RwLock, ThreadKey};
#[test]
fn get_mut_applies_changes() {
@@ -778,4 +778,12 @@ mod tests {
42
);
}
+
+ #[test]
+ fn duplicates_detected() {
+ let collection1 = OwnedLockCollection::new([Mutex::new(5), Mutex::new(10)]);
+ let collection2 = LockCollection::try_new((&collection1, &collection1));
+
+ assert!(collection2.is_none());
+ }
}