Skip to content

Commit

Permalink
Make partition_types::Type::FromStr case-insensitive for guid
Browse files Browse the repository at this point in the history
  • Loading branch information
IronBatman2715 committed Sep 2, 2024
1 parent 6e98a3f commit 6822f6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod pub_macros {
impl FromStr for Type {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
match s.to_ascii_uppercase().as_str() {
$(
$guid |
stringify!($upcase) => Ok($upcase),
Expand Down
6 changes: 6 additions & 0 deletions src/partition_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ mod tests {
Type::from_str("00000000-0000-0000-0000-000000000000").unwrap(),
UNUSED
);

// test case sensitivity
assert_eq!(
Type::from_str("ebd0a0a2-b9e5-4433-87c0-68b6b72699c7").unwrap(),
BASIC
);
}

#[test]
Expand Down

0 comments on commit 6822f6e

Please sign in to comment.