You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/08/29 06:39:21 UTC

[avro] branch master updated: AVRO-3621: Check the argument of assert_not_logged() against the last logged message before panicing

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new 09041faca AVRO-3621: Check the argument of assert_not_logged() against the last logged message before panicing
09041faca is described below

commit 09041facad0a4c2c131b7ffde6497d7580b964b9
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Fri Aug 26 15:19:24 2022 +0300

    AVRO-3621: Check the argument of assert_not_logged() against the last logged message before panicing
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
 lang/rust/avro_test_helper/src/logger.rs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lang/rust/avro_test_helper/src/logger.rs b/lang/rust/avro_test_helper/src/logger.rs
index 97b7e7cb9..87e7d7148 100644
--- a/lang/rust/avro_test_helper/src/logger.rs
+++ b/lang/rust/avro_test_helper/src/logger.rs
@@ -56,11 +56,12 @@ pub fn clear_log_messages() {
 }
 
 pub fn assert_not_logged(unexpected_message: &str) {
-    if let Some(_last_log) = LOG_MESSAGES.borrow().last() {
-        panic!(
+    match LOG_MESSAGES.borrow().last() {
+        Some(last_log) if last_log == unexpected_message => panic!(
             "The following log message should not have been logged: '{}'",
             unexpected_message
-        );
+        ),
+        _ => (),
     }
 }