From 5c252bd8e47c99611e29110eeb3cbcd94cfb6519 Mon Sep 17 00:00:00 2001 From: Evan Mesterhazy Date: Mon, 12 Feb 2024 16:01:11 -0500 Subject: [PATCH] Add test cases where HexPrefix::new fails due to invalid inputs --- lib/src/object_id.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/object_id.rs b/lib/src/object_id.rs index a0b57e9ab..6ad5149b1 100644 --- a/lib/src/object_id.rs +++ b/lib/src/object_id.rs @@ -224,6 +224,12 @@ mod tests { let prefix = HexPrefix::new("123").unwrap(); assert_eq!(prefix.min_prefix_bytes(), b"\x12\x30"); + + let bad_prefix = HexPrefix::new("0x123"); + assert_eq!(bad_prefix, None); + + let bad_prefix = HexPrefix::new("foobar"); + assert_eq!(bad_prefix, None); } #[test]