Browse Source

Fix tests in `--release` mode (#6308)

Add `#[cfg]` annotations to some tests which rely on `debug_assert!` for
panics.
pull/6311/head
Alex Crichton 2 years ago
committed by GitHub
parent
commit
8eccc63c46
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cranelift/codegen/src/ir/builder.rs
  2. 2
      cranelift/entity/src/lib.rs

5
cranelift/codegen/src/ir/builder.rs

@ -218,7 +218,7 @@ mod tests {
use crate::cursor::{Cursor, FuncCursor};
use crate::ir::condcodes::*;
use crate::ir::types::*;
use crate::ir::{Function, InstBuilder, Opcode, TrapCode, ValueDef};
use crate::ir::{Function, InstBuilder, ValueDef};
#[test]
fn types() {
@ -266,7 +266,10 @@ mod tests {
#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn panics_when_inserting_wrong_opcode() {
use crate::ir::{Opcode, TrapCode};
let mut func = Function::new();
let block0 = func.dfg.make_block();
let mut pos = FuncCursor::new(&mut func);

2
cranelift/entity/src/lib.rs

@ -254,6 +254,7 @@ mod tests {
}
#[should_panic]
#[cfg(debug_assertions)]
#[test]
fn cannot_construct_from_reserved_u32() {
use crate::packed_option::ReservedValue;
@ -262,6 +263,7 @@ mod tests {
}
#[should_panic]
#[cfg(debug_assertions)]
#[test]
fn cannot_construct_from_reserved_usize() {
use crate::packed_option::ReservedValue;

Loading…
Cancel
Save