Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/macro_expansion_tests/mbe.rs')
-rw-r--r--crates/hir-def/src/macro_expansion_tests/mbe.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/crates/hir-def/src/macro_expansion_tests/mbe.rs b/crates/hir-def/src/macro_expansion_tests/mbe.rs
index 457e43925c..2d5f2a692e 100644
--- a/crates/hir-def/src/macro_expansion_tests/mbe.rs
+++ b/crates/hir-def/src/macro_expansion_tests/mbe.rs
@@ -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";
+}
+"#]],
+ );
+}