From 50505d81cc32c9a58df00a8c582e1ab6a1980d9d Mon Sep 17 00:00:00 2001 From: David Niehues Date: Fri, 13 Dec 2024 16:01:06 +0100 Subject: [PATCH] test: fix doctest in alloc/mod.rs to make it work on macos --- secret-memory/src/alloc/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/secret-memory/src/alloc/mod.rs b/secret-memory/src/alloc/mod.rs index f4cddc2..68001ca 100644 --- a/secret-memory/src/alloc/mod.rs +++ b/secret-memory/src/alloc/mod.rs @@ -53,8 +53,14 @@ pub fn set_secret_alloc_type(alloc_type: SecretAllocType) { /// # use rosenpass_secret_memory::alloc::{get_or_init_secret_alloc_type, set_secret_alloc_type, /// # SecretAlloc, SecretAllocType}; /// set_secret_alloc_type(SecretAllocType::MemsecMalloc); -/// let alloc_typpe = get_or_init_secret_alloc_type(SecretAllocType::MemsecMemfdSec); -/// assert_eq!(alloc_typpe, SecretAllocType::MemsecMalloc); +/// #[cfg(target_os = "linux")] { +/// let alloc_typpe = get_or_init_secret_alloc_type(SecretAllocType::MemsecMemfdSec); +/// assert_eq!(alloc_typpe, SecretAllocType::MemsecMalloc); +/// } +/// #[cfg(not(target_os = "linux"))] { +/// let alloc_typpe = get_or_init_secret_alloc_type(SecretAllocType::MemsecMalloc); +/// assert_eq!(alloc_typpe, SecretAllocType::MemsecMalloc); +/// } ///``` pub fn get_or_init_secret_alloc_type(alloc_type: SecretAllocType) -> SecretAllocType { *ALLOC_TYPE.get_or_init(|| alloc_type)