Add AST pretty-printer tests involving attr on binary operation
This test currently fails (as expected).
--- stderr -------------------------------
Pretty-printer lost necessary parentheses
BEFORE: #[attr] (1 + 1)
AFTER: #[attr] 1 + 1
Pretty-printer lost necessary parentheses
BEFORE: #[attr] (1 as T)
AFTER: #[attr] 1 as T
Pretty-printer lost necessary parentheses
BEFORE: #[attr] (x = 1)
AFTER: #[attr] x = 1
Pretty-printer lost necessary parentheses
BEFORE: #[attr] (x += 1)
AFTER: #[attr] x += 1
------------------------------------------
This commit is contained in:
parent
1ed0cbf698
commit
cbef8f6e07
1 changed files with 9 additions and 0 deletions
|
|
@ -92,6 +92,15 @@ static EXPRS: &[&str] = &[
|
|||
"#[attr] loop {}.field",
|
||||
"(#[attr] loop {}).field",
|
||||
"loop { #![attr] }.field",
|
||||
// Attributes on a Binary, Cast, Assign, AssignOp, and Range expression
|
||||
// require parentheses. Without parentheses `#[attr] lo..hi` means
|
||||
// `(#[attr] lo)..hi`, and `#[attr] ..hi` is invalid syntax.
|
||||
"#[attr] (1 + 1)",
|
||||
"#[attr] (1 as T)",
|
||||
"#[attr] (x = 1)",
|
||||
"#[attr] (x += 1)",
|
||||
"#[attr] (lo..hi)",
|
||||
"#[attr] (..hi)",
|
||||
// Grammar restriction: break value starting with a labeled loop is not
|
||||
// allowed, except if the break is also labeled.
|
||||
"break 'outer 'inner: loop {} + 2",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue