diff --git a/tests/basic.rs b/tests/basic.rs index bbf2395..e688ed8 100644 --- a/tests/basic.rs +++ b/tests/basic.rs @@ -41,4 +41,30 @@ fn allocation_flag() { let _x = Box::new(42); assert!(A.has_allocated()); +} + +#[inline(never)] +fn no_op() {} + +#[test] +fn no_alloc_during_noop() { + A.clear_allocations(); + assert!(!A.has_allocated()); + + no_op(); + assert!(!A.has_allocated()); +} + +#[inline(never)] +fn allocates() { + let _x = Box::new(42); +} + +#[test] +fn alloc_during_func_call() { + A.clear_allocations(); + assert!(!A.has_allocated()); + + allocates(); + assert!(A.has_allocated()); } \ No newline at end of file