Skip to content

Commit

Permalink
chore: Allow apostrophes in attributes (#3374)
Browse files Browse the repository at this point in the history
  • Loading branch information
kek kek kek authored Nov 2, 2023
1 parent 8a36877 commit 3d76fd2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions compiler/noirc_frontend/src/lexer/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,20 @@ mod tests {
);
}

#[test]
fn test_attribute_with_apostrophe() {
let input = r#"#[test(should_fail_with = "the eagle's feathers")]"#;
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() }
)))
);
}

#[test]
fn deprecated_attribute_with_note() {
let input = r#"#[deprecated("hello")]"#;
Expand Down
1 change: 1 addition & 0 deletions compiler/noirc_frontend/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ impl Attribute {
|| ch == '='
|| ch == '"'
|| ch == ' '
|| ch == '\''
})
.then_some(());

Expand Down

0 comments on commit 3d76fd2

Please sign in to comment.