diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-14 10:52:12 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-14 10:52:12 +0000 |
commit | d76143da19fcfcd210acc930e68acd6c43db9088 (patch) | |
tree | 0a1aab6dbe05e7a16caad5f58a787fd39abda6b8 /crates/mbe | |
parent | d635806ea5090426cd4a5a57601a7f823277e84c (diff) | |
parent | 8d62576a9b47922ce58ac757e6e4944d45b223a6 (diff) |
Merge #7211
7211: Fixed expr meta var after path colons in mbe r=matklad a=edwin0cheng
Fixes #7207
Added `L_DOLLAR` in `ITEM_RECOVERY_SET` , but I don't know whether it is a good idea.
r? @matklad
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/mbe')
-rw-r--r-- | crates/mbe/src/tests.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs index ecea15c11..9ff901e97 100644 --- a/crates/mbe/src/tests.rs +++ b/crates/mbe/src/tests.rs | |||
@@ -1,7 +1,11 @@ | |||
1 | use std::fmt::Write; | 1 | use std::fmt::Write; |
2 | 2 | ||
3 | use ::parser::FragmentKind; | 3 | use ::parser::FragmentKind; |
4 | use syntax::{ast, AstNode, NodeOrToken, SyntaxKind::IDENT, SyntaxNode, WalkEvent, T}; | 4 | use syntax::{ |
5 | ast, AstNode, NodeOrToken, | ||
6 | SyntaxKind::{ERROR, IDENT}, | ||
7 | SyntaxNode, WalkEvent, T, | ||
8 | }; | ||
5 | use test_utils::assert_eq_text; | 9 | use test_utils::assert_eq_text; |
6 | 10 | ||
7 | use super::*; | 11 | use super::*; |
@@ -1194,6 +1198,23 @@ macro_rules! foo { | |||
1194 | ); | 1198 | ); |
1195 | } | 1199 | } |
1196 | 1200 | ||
1201 | #[test] | ||
1202 | fn test_expr_after_path_colons() { | ||
1203 | assert!(parse_macro( | ||
1204 | r#" | ||
1205 | macro_rules! m { | ||
1206 | ($k:expr) => { | ||
1207 | f(K::$k); | ||
1208 | } | ||
1209 | } | ||
1210 | "#, | ||
1211 | ) | ||
1212 | .expand_statements(r#"m!(C("0"))"#) | ||
1213 | .descendants() | ||
1214 | .find(|token| token.kind() == ERROR) | ||
1215 | .is_some()); | ||
1216 | } | ||
1217 | |||
1197 | // The following tests are based on real world situations | 1218 | // The following tests are based on real world situations |
1198 | #[test] | 1219 | #[test] |
1199 | fn test_vec() { | 1220 | fn test_vec() { |