More tests

pull/3/head
Bradlee Speice 2018-09-22 19:57:58 -04:00
parent 5755eccae7
commit 6c3ebfa433
1 changed files with 26 additions and 0 deletions

View File

@ -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());
}