Skip to content

Commit

Permalink
Add test of None-delimited group containing loop in match arm
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 11, 2023
1 parent d332928 commit 2781584
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion tests/test_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ fn test_macro_variable_match_arm() {
// mimics the token stream corresponding to `match v { _ => $expr }`
let expr = Group::new(Delimiter::None, quote! { #[a] () });
let tokens = quote!(match v { _ => #expr });

snapshot!(tokens as Expr, @r###"
Expr::Match {
expr: Expr::Path {
Expand Down Expand Up @@ -270,6 +269,41 @@ fn test_macro_variable_match_arm() {
],
}
"###);

let expr = Group::new(Delimiter::None, quote!(loop {} + 1));
let tokens = quote!(match v { _ => #expr });
// FIXME
snapshot!(tokens as Expr, @r###"
Expr::Match {
expr: Expr::Path {
path: Path {
segments: [
PathSegment {
ident: "v",
},
],
},
},
arms: [
Arm {
pat: Pat::Wild,
body: Expr::Group {
expr: Expr::Binary {
left: Expr::Loop {
body: Block {
stmts: [],
},
},
op: BinOp::Add,
right: Expr::Lit {
lit: 1,
},
},
},
},
],
}
"###);
}

// https://github.com/dtolnay/syn/issues/1019
Expand Down

0 comments on commit 2781584

Please sign in to comment.