-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make names & emails ASCII-case-insensitive
- Loading branch information
1 parent
5b2c975
commit a1e9e01
Showing
3 changed files
with
58 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ categories = ["parsing"] | |
license = "MIT OR Apache-2.0" | ||
|
||
[dependencies] | ||
uncased = "0.9.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ fn comment_2() { | |
fn email_1() { | ||
assert_eq!( | ||
test_parser!(read_email, "<[email protected]>", ""), | ||
Some("[email protected]") | ||
Some("[email protected]".into()) | ||
); | ||
} | ||
|
||
|
@@ -35,7 +35,7 @@ fn email_2() { | |
"<[email protected]> <[email protected]>", | ||
" <[email protected]>" | ||
), | ||
Some("[email protected]") | ||
Some("[email protected]".into()) | ||
); | ||
} | ||
|
||
|
@@ -59,7 +59,7 @@ fn name_1() { | |
"Canonical Name <[email protected]>", | ||
"<[email protected]>" | ||
), | ||
Some("Canonical Name"), | ||
Some("Canonical Name".into()), | ||
); | ||
} | ||
|
||
|
@@ -68,10 +68,10 @@ fn line_1() { | |
assert_eq!( | ||
parse_line("Joe Bob <email1> <email2>", 0), | ||
Some(MapEntry { | ||
canonical_name: Some("Joe Bob"), | ||
canonical_email: Some("email1"), | ||
canonical_name: Some("Joe Bob".into()), | ||
canonical_email: Some("email1".into()), | ||
current_name: None, | ||
current_email: Some("email2"), | ||
current_email: Some("email2".into()), | ||
}) | ||
); | ||
} | ||
|
@@ -81,18 +81,18 @@ fn line_2() { | |
assert_eq!( | ||
parse_line("Joe Bob <email1>", 0), | ||
Some(MapEntry { | ||
canonical_name: Some("Joe Bob"), | ||
canonical_email: Some("email1"), | ||
canonical_name: Some("Joe Bob".into()), | ||
canonical_email: Some("email1".into()), | ||
current_name: None, | ||
current_email: Some("email1"), | ||
current_email: Some("email1".into()), | ||
}) | ||
); | ||
} | ||
|
||
fn a(name: &str, email: &str) -> Author { | ||
Author { | ||
name: name.into(), | ||
email: email.into(), | ||
name: name.to_owned().into(), | ||
email: email.to_owned().into(), | ||
} | ||
} | ||
|
||
|
@@ -123,3 +123,12 @@ fn map_4() { | |
let mm = map("<PE> <CE>"); | ||
assert_eq!(mm.canonicalize(&a("any", "CE")), a("any", "PE")); | ||
} | ||
|
||
#[test] | ||
fn case_insensitive() { | ||
let mm = map("Proper Name <[email protected]> CoMmIt NaMe <[email protected]>"); | ||
assert_eq!( | ||
mm.canonicalize(&a("Commit Name", "[email protected]")), | ||
a("Proper Name", "[email protected]") | ||
); | ||
} |