mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-26 17:31:44 +00:00
Merge pull request #1251 from dtolnay/instaloop
Fix invalid use of insta snapshot inside a loop
This commit is contained in:
commit
876a605f75
@ -53,36 +53,37 @@ fn test_await() {
|
||||
#[rustfmt::skip]
|
||||
#[test]
|
||||
fn test_tuple_multi_index() {
|
||||
let expected = snapshot!("tuple.0.0" as Expr, @r###"
|
||||
Expr::Field {
|
||||
base: Expr::Field {
|
||||
base: Expr::Path {
|
||||
path: Path {
|
||||
segments: [
|
||||
PathSegment {
|
||||
ident: "tuple",
|
||||
arguments: None,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
member: Unnamed(Index {
|
||||
index: 0,
|
||||
}),
|
||||
},
|
||||
member: Unnamed(Index {
|
||||
index: 0,
|
||||
}),
|
||||
}
|
||||
"###);
|
||||
|
||||
for &input in &[
|
||||
"tuple.0.0",
|
||||
"tuple .0.0",
|
||||
"tuple. 0.0",
|
||||
"tuple.0 .0",
|
||||
"tuple.0. 0",
|
||||
"tuple . 0 . 0",
|
||||
] {
|
||||
snapshot!(input as Expr, @r###"
|
||||
Expr::Field {
|
||||
base: Expr::Field {
|
||||
base: Expr::Path {
|
||||
path: Path {
|
||||
segments: [
|
||||
PathSegment {
|
||||
ident: "tuple",
|
||||
arguments: None,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
member: Unnamed(Index {
|
||||
index: 0,
|
||||
}),
|
||||
},
|
||||
member: Unnamed(Index {
|
||||
index: 0,
|
||||
}),
|
||||
}
|
||||
"###);
|
||||
assert_eq!(expected, syn::parse_str(input).unwrap());
|
||||
}
|
||||
|
||||
for tokens in vec![
|
||||
@ -93,28 +94,7 @@ fn test_tuple_multi_index() {
|
||||
quote!(tuple.0. 0),
|
||||
quote!(tuple . 0 . 0),
|
||||
] {
|
||||
snapshot!(tokens as Expr, @r###"
|
||||
Expr::Field {
|
||||
base: Expr::Field {
|
||||
base: Expr::Path {
|
||||
path: Path {
|
||||
segments: [
|
||||
PathSegment {
|
||||
ident: "tuple",
|
||||
arguments: None,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
member: Unnamed(Index {
|
||||
index: 0,
|
||||
}),
|
||||
},
|
||||
member: Unnamed(Index {
|
||||
index: 0,
|
||||
}),
|
||||
}
|
||||
"###);
|
||||
assert_eq!(expected, syn::parse2(tokens).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user