-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add number chars to allowed name chars
- Loading branch information
1 parent
912d3aa
commit 4d6613f
Showing
1 changed file
with
14 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -36,7 +36,7 @@ pub struct Cursor<'a> { | |
|
||
macro_rules! name_chars { | ||
() => { | ||
'a'..='z' | 'A'..='Z' | '!' | '#' | '$' | '%' | ||
'a'..='z' | 'A'..='Z' | '0'..= '9' | '!' | '#' | '$' | '%' | ||
| '&' | '\'' | '*' | '+' | '-' | '/' | '=' | ||
| '?' | '^' | '_' | '`' | '{' | '}' | '|' | '~' | ||
}; | ||
|
@@ -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] | ||
|