1
0
mirror of https://github.com/bspeice/qadapt synced 2025-08-27 09:46:47 -04:00

Fix conditional compilation guards

This commit is contained in:
2018-11-18 21:29:32 -05:00
parent 79f57ba2f9
commit 5d7be8e18e
6 changed files with 101 additions and 62 deletions

View File

@ -17,7 +17,7 @@ fn test_copy() {
}
#[test]
#[should_panic]
#[cfg_attr(debug_assertions, should_panic)]
fn test_allocate() {
enter_protected();
let _x = Box::new(12);
@ -90,7 +90,7 @@ fn vec_with_one() {
}
#[test]
#[should_panic]
#[cfg_attr(debug_assertions, should_panic)]
fn exit_too_often() {
enter_protected();
exit_protected();
@ -98,7 +98,7 @@ fn exit_too_often() {
}
#[test]
#[should_panic]
#[cfg_attr(debug_assertions, should_panic)]
fn intentional_drop() {
let v: Vec<()> = Vec::new();
let v = Box::new(v);

View File

@ -9,11 +9,6 @@ static Q: QADAPT = QADAPT;
#[allocate_panic]
fn no_allocate() {
#[cfg(not(release))]
{
let _v = 0;
}
assert_eq!(::qadapt::protection_level(), 1);
let _v: Vec<()> = Vec::with_capacity(0);
}
@ -149,3 +144,16 @@ fn example_closure() {
fn macro_closure() {
example_closure()
}
#[test]
#[allocate_panic]
fn macro_release_safe() {
#[cfg(debug_assertions)]
{
assert_eq!(1, ::qadapt::protection_level());
}
#[cfg(not(debug_assertions))]
{
assert_eq!(0, ::qadapt::protection_level());
}
}