Skip to content

Commit

Permalink
Add test cases where HexPrefix::new fails due to invalid inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
emesterhazy committed Mar 1, 2024
1 parent 82b3017 commit 5c252bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/src/object_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 5c252bd

Please sign in to comment.