mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-19 02:55:20 +00:00
Add Lexer emoji test case (#7213)
This commit is contained in:
parent
f1a4eb9c28
commit
842ff0212e
1 changed files with 18 additions and 0 deletions
|
@ -1716,4 +1716,22 @@ def f(arg=%timeit a = b):
|
|||
let source = "[1";
|
||||
let _ = lex(source, Mode::Module).collect::<Vec<_>>();
|
||||
}
|
||||
|
||||
/// Emoji identifiers are a non-standard python feature and are not supported by our lexer.
|
||||
#[test]
|
||||
fn test_emoji_identifier() {
|
||||
let source = "🐦";
|
||||
|
||||
let lexed: Vec<_> = lex(source, Mode::Module).collect();
|
||||
|
||||
match lexed.as_slice() {
|
||||
[Err(error)] => {
|
||||
assert_eq!(
|
||||
error.error,
|
||||
LexicalErrorType::UnrecognizedToken { tok: '🐦' }
|
||||
);
|
||||
}
|
||||
result => panic!("Expected an error token but found {result:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue