From e0cc382eeb48e0d6692e4b5adeee8d113e54f989 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 3 Apr 2022 21:02:24 +0200 Subject: [PATCH] Improve tests --- src/proto.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/proto.rs b/src/proto.rs index 73bbd52..da0a989 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -237,7 +237,7 @@ mod tests { assert_eq!( parse_result.err(), Some(DNSParseError::DNSOpCodeInvalid), - "query: {:?}, opcode: {}", + "query: {:02x?}, opcode: {}", dns_query, opcode ); @@ -261,7 +261,11 @@ mod tests { for (idx, opcode) in valid_opcodes.iter().enumerate() { dns_query[2] = opcode << 3; let parse_result = DNSHeader::from_udp_datagram(&dns_query); - assert_eq!(parse_result?.opcode, valid_parsed_opcodes[idx]); + assert_eq!( + parse_result?.opcode, valid_parsed_opcodes[idx], + "query: {:02x?}, opcode: {}", + dns_query, opcode + ); } Ok(()) }