tamer: Ensure debug_assert! takes effect in test profile

I'd feel rather silly if I used `debug_assert!` for the sake of tests and
they weren't actually being run due to optimization settings.

This is just to catch potential future regressions; all is well today.

DEV-7145
main
Mike Gerwitz 2022-07-05 14:59:35 -04:00
parent 40c68d3e1e
commit 6385270fe6
1 changed files with 15 additions and 0 deletions

View File

@ -18,3 +18,18 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pub mod quick_xml;
/// Ensures that tests will hit debug assertions.
///
/// Debug assertions are used to enforce invariants that would certainly be
/// hit by tests if violated,
/// and so have no need to be included in release builds.
///
/// If this test fails,
/// then optimization settings are inhibiting debug assertions.
/// See the documentation for [`debug_assert!`] for more information.
#[test]
#[should_panic]
fn uses_debug_assertions() {
debug_assert!(false, "should panic");
}