Blob Blame History Raw
From 356220985d3c0f87b545b3f9f8997833e1e9ada1 Mon Sep 17 00:00:00 2001
From: Luca Bruno <luca.bruno@coreos.com>
Date: Thu, 6 Jun 2019 08:11:45 +0000
Subject: [PATCH 1/2] counter: fix tests in release mode (#246)

This fixes `should_panic` tests in release mode, as they rely on
debug assertions.
---
 src/counter.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/counter.rs b/src/counter.rs
index 2099933..a2b9bdb 100644
--- a/src/counter.rs
+++ b/src/counter.rs
@@ -511,6 +511,7 @@ mod tests {
         assert_eq!(vec.with_label_values(&["v1", "v2"]).get(), 34);
     }
 
+    #[cfg(debug_assertions)]
     #[test]
     #[should_panic(expected = "assertion failed")]
     fn test_counter_negative_inc() {
@@ -518,6 +519,7 @@ mod tests {
         counter.inc_by(-42.0);
     }
 
+    #[cfg(debug_assertions)]
     #[test]
     #[should_panic(expected = "assertion failed")]
     fn test_local_counter_negative_inc() {
@@ -526,6 +528,7 @@ mod tests {
         local.inc_by(-42.0);
     }
 
+    #[cfg(debug_assertions)]
     #[test]
     #[should_panic(expected = "assertion failed")]
     fn test_int_counter_negative_inc() {
@@ -533,6 +536,7 @@ mod tests {
         counter.inc_by(-42);
     }
 
+    #[cfg(debug_assertions)]
     #[test]
     #[should_panic(expected = "assertion failed")]
     fn test_int_local_counter_negative_inc() {
-- 
2.22.0