Skip to content

Commit 3e8ef94

Browse files
committed
internal: move some tests
1 parent a060b9a commit 3e8ef94

File tree

3 files changed

+38
-22
lines changed

3 files changed

+38
-22
lines changed

crates/hir_def/src/macro_expansion_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
126126
(T![>], IDENT) => " ",
127127
(T![>], _) if curr_kind.is_keyword() => " ",
128128
(T![->], _) | (_, T![->]) => " ",
129+
(T![&&], _) | (_, T![&&]) => " ",
129130
_ => "",
130131
};
131132

crates/hir_def/src/macro_expansion_tests/mbe.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,40 @@ fn bar() {
346346
"#]],
347347
)
348348
}
349+
350+
#[test]
351+
fn test_match_group_with_multichar_sep() {
352+
check(
353+
r#"
354+
macro_rules! m {
355+
(fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
356+
}
357+
m! (fn baz { true false } );
358+
"#,
359+
expect![[r#"
360+
macro_rules! m {
361+
(fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
362+
}
363+
fn baz() -> bool {
364+
true && false
365+
}
366+
"#]],
367+
);
368+
369+
check(
370+
r#"
371+
macro_rules! m {
372+
(fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
373+
}
374+
m! (fn baz { true && false } );
375+
"#,
376+
expect![[r#"
377+
macro_rules! m {
378+
(fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
379+
}
380+
fn baz() -> bool {
381+
true && false
382+
}
383+
"#]],
384+
);
385+
}

crates/mbe/src/tests/expand.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,6 @@ macro_rules! foobar {
7171
assert_eq!(get_text(tt::TokenId(13), T!['{']), "{");
7272
}
7373

74-
#[test]
75-
fn test_match_group_with_multichar_sep() {
76-
parse_macro(
77-
r#"
78-
macro_rules! foo {
79-
(fn $name:ident {$($i:literal)*} ) => ( fn $name() -> bool { $($i)&&*} );
80-
}"#,
81-
)
82-
.assert_expand_items("foo! (fn baz {true true} );", "fn baz () -> bool {true &&true}");
83-
}
84-
85-
#[test]
86-
fn test_match_group_with_multichar_sep2() {
87-
parse_macro(
88-
r#"
89-
macro_rules! foo {
90-
(fn $name:ident {$($i:literal)&&*} ) => ( fn $name() -> bool { $($i)&&*} );
91-
}"#,
92-
)
93-
.assert_expand_items("foo! (fn baz {true && true} );", "fn baz () -> bool {true &&true}");
94-
}
95-
9674
#[test]
9775
fn test_match_group_zero_match() {
9876
parse_macro(

0 commit comments

Comments
 (0)