From 429b4dae68ed7599f9ec0dc57680eb76df15f2fa Mon Sep 17 00:00:00 2001 From: Mingun Date: Thu, 27 Jul 2023 22:52:59 +0500 Subject: [PATCH] Show expected error in `assert_ser_tokens_error` --- src/assert.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/assert.rs b/src/assert.rs index 44dfa6c..9667db5 100644 --- a/src/assert.rs +++ b/src/assert.rs @@ -128,7 +128,11 @@ where { let mut ser = Serializer::new(tokens); match value.serialize(&mut ser) { - Ok(_) => panic!("value serialized successfully"), + Ok(_) => assert_eq!( + None, + Some(error), + "value serialized successfully, but error expected (right)" + ), Err(e) => assert_eq!(e, *error), }