mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
mbe: split Op::Leaf
and handle multi-character puncts
This commit is contained in:
parent
47c6c8e2f3
commit
ec7148b091
6 changed files with 183 additions and 56 deletions
|
@ -1630,3 +1630,48 @@ const _: i32 = -0--1--2;
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_punct_without_space() {
|
||||
// Puncts are "glued" greedily.
|
||||
check(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
(: : :) => { "1 1 1" };
|
||||
(: ::) => { "1 2" };
|
||||
(:: :) => { "2 1" };
|
||||
|
||||
(: : : :) => { "1 1 1 1" };
|
||||
(:: : :) => { "2 1 1" };
|
||||
(: :: :) => { "1 2 1" };
|
||||
(: : ::) => { "1 1 2" };
|
||||
(:: ::) => { "2 2" };
|
||||
}
|
||||
|
||||
fn test() {
|
||||
foo!(:::);
|
||||
foo!(: :::);
|
||||
foo!(::::);
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
macro_rules! foo {
|
||||
(: : :) => { "1 1 1" };
|
||||
(: ::) => { "1 2" };
|
||||
(:: :) => { "2 1" };
|
||||
|
||||
(: : : :) => { "1 1 1 1" };
|
||||
(:: : :) => { "2 1 1" };
|
||||
(: :: :) => { "1 2 1" };
|
||||
(: : ::) => { "1 1 2" };
|
||||
(:: ::) => { "2 2" };
|
||||
}
|
||||
|
||||
fn test() {
|
||||
"2 1";
|
||||
"1 2 1";
|
||||
"2 2";
|
||||
}
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue