Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 6 additions & 3 deletions compiler/noirc_frontend/src/lexer/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,15 +633,18 @@ mod tests {
}

#[test]
fn test_attribute_with_apostrophe() {
let input = r#"#[test(should_fail_with = "the eagle's feathers")]"#;
fn test_attribute_with_common_punctuation() {
let input =
r#"#[test(should_fail_with = "stmt. q? exclaim! & symbols, 1% shouldn't fail")]"#;
let mut lexer = Lexer::new(input);

let token = lexer.next_token().unwrap().token().clone();
assert_eq!(
token,
Token::Attribute(Attribute::Function(FunctionAttribute::Test(
TestScope::ShouldFailWith { reason: "the eagle's feathers".to_owned().into() }
TestScope::ShouldFailWith {
reason: "stmt. q? exclaim! & symbols, 1% shouldn't fail".to_owned().into()
}
)))
);
}
Expand Down
7 changes: 1 addition & 6 deletions compiler/noirc_frontend/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,8 @@ impl Attribute {
.all(|ch| {
ch.is_ascii_alphabetic()
|| ch.is_numeric()
|| ch == '_'
|| ch == '('
|| ch == ')'
|| ch == '='
|| ch == '"'
|| ch.is_ascii_punctuation()
|| ch == ' '
|| ch == '\''
})
.then_some(());

Expand Down