9436: minor: Add test for macro expanded test module in runnables r=Veykril a=Veykril

Expected this to fail as thats behaving incorrectly on current nightly but I think I fixed this accidentally with https://github.com/rust-analyzer/rust-analyzer/pull/9435
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-06-30 17:37:28 +00:00 committed by GitHub
commit 2f9645501c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1221,15 +1221,23 @@ fn test_runnables_in_macro() {
macro_rules! gen {
() => {
#[test]
fn foo_test() {
fn foo_test() {}
}
}
macro_rules! gen2 {
() => {
mod m_tests {
#[test]
fn foo_test() {}
}
}
}
mod tests {
gen!();
}
gen2!();
"#,
&[&TEST_MOD, &TEST],
&[&TEST_MOD, &TEST_MOD, &TEST, &TEST],
expect![[r#"
[
Runnable {
@ -1237,8 +1245,8 @@ mod tests {
file_id: FileId(
0,
),
full_range: 90..115,
focus_range: 94..99,
full_range: 202..227,
focus_range: 206..211,
name: "tests",
kind: Module,
description: "mod tests",
@ -1253,8 +1261,24 @@ mod tests {
file_id: FileId(
0,
),
full_range: 106..113,
focus_range: 106..113,
full_range: 228..236,
focus_range: 228..236,
name: "m_tests",
kind: Module,
description: "mod m_tests",
},
kind: TestMod {
path: "m_tests",
},
cfg: None,
},
Runnable {
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 218..225,
focus_range: 218..225,
name: "foo_test",
kind: Function,
},
@ -1268,6 +1292,26 @@ mod tests {
},
cfg: None,
},
Runnable {
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 228..236,
focus_range: 228..236,
name: "foo_test",
kind: Function,
},
kind: Test {
test_id: Path(
"m_tests::foo_test",
),
attr: TestAttr {
ignore: false,
},
},
cfg: None,
},
]
"#]],
);