Skip to content

Commit

Permalink
Add number chars to allowed name chars
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooper1386 authored and tu6ge committed Sep 3, 2024
1 parent 912d3aa commit 4d6613f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/rule/available/email/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Cursor<'a> {

macro_rules! name_chars {
() => {
'a'..='z' | 'A'..='Z' | '!' | '#' | '$' | '%'
'a'..='z' | 'A'..='Z' | '0'..= '9' | '!' | '#' | '$' | '%'
| '&' | '\'' | '*' | '+' | '-' | '/' | '='
| '?' | '^' | '_' | '`' | '{' | '}' | '|' | '~'
};
Expand Down Expand Up @@ -280,6 +280,19 @@ mod tests {
let at = cursor.advance().unwrap();

assert_eq!(at, EmailToken::At);

// Add regression test for numbers
let str = "[email protected]";

let mut cursor = Cursor::new(str);

let tokens = cursor.advance().unwrap();

assert_eq!(format!("{tokens:?}"), "Name(\"abc123\")");

let at = cursor.advance().unwrap();

assert_eq!(at, EmailToken::At);
}

#[test]
Expand Down

0 comments on commit 4d6613f

Please sign in to comment.