Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make partition_types::Type::FromStr case-insensitive for guid #104

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
@@ -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),
6 changes: 6 additions & 0 deletions src/partition_types.rs
Original file line number Diff line number Diff line change
@@ -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]