Skip to content

Commit

Permalink
Add test of let dot dot
Browse files Browse the repository at this point in the history
Currently fails:

    ---- test_let_dot_dot stdout ----
    thread 'test_let_dot_dot' panicked at 'called `Result::unwrap()` on an `Err` value: Error("expected one of: literal, identifier, `::`, `<`, `self`, `Self`, `super`, `crate`, `const`")', tests/test_stmt.rs:85:5
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  • Loading branch information
dtolnay committed Mar 14, 2022
1 parent 1a0cf9d commit b7aaa08
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
mod macros;

use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
use quote::quote;
use std::iter::FromIterator;
use syn::Stmt;

Expand Down Expand Up @@ -74,3 +75,19 @@ fn test_none_group() {
})
"###);
}

#[test]
fn test_let_dot_dot() {
let tokens = quote! {
let .. = 10;
};

snapshot!(tokens as Stmt, @r###"
Local(Local {
pat: Pat::Rest,
init: Some(Expr::Lit {
lit: 10,
}),
})
"###);
}

0 comments on commit b7aaa08

Please sign in to comment.