Skip to content

Commit 915a1ee

Browse files
Fabian-Gruenbichlerfolkertdev
authored andcommitted
zlib-rs: properly guard tests by allocator
so that both `cargo test --no-default-features --features c-allocator` and `cargo test --no-default-features --features rust-allocator` pass. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
1 parent d60dc53 commit 915a1ee

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

zlib-rs/src/deflate.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,6 +3309,7 @@ mod test {
33093309
}
33103310
}
33113311

3312+
#[cfg(feature = "c-allocator")]
33123313
unsafe extern "C" fn fail_nth_allocation<const N: usize>(
33133314
opaque: crate::c_api::voidpf,
33143315
items: crate::c_api::uInt,
@@ -3327,6 +3328,7 @@ mod test {
33273328
}
33283329

33293330
#[test]
3331+
#[cfg(feature = "c-allocator")]
33303332
fn init_invalid_allocator() {
33313333
{
33323334
let atomic = AtomicUsize::new(0);
@@ -3371,6 +3373,7 @@ mod test {
33713373
}
33723374
}
33733375

3376+
#[cfg(feature = "c-allocator")]
33743377
mod copy_invalid_allocator {
33753378
use super::*;
33763379

zlib-rs/src/inflate/window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl<'a> Window<'a> {
173173
}
174174
}
175175

176-
#[cfg(test)]
176+
#[cfg(all(test, feature = "rust-allocator"))]
177177
mod test {
178178
use super::*;
179179

0 commit comments

Comments
 (0)