Skip to content

Commit

Permalink
Add test for macro expanded test module in runnables
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Jun 30, 2021
1 parent b8507ca commit 8d3a378
Showing 1 changed file with 50 additions and 6 deletions.
56 changes: 50 additions & 6 deletions crates/ide/src/runnables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,24 +1221,32 @@ $0
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 {
nav: NavigationTarget {
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",
Expand All @@ -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,
},
Expand All @@ -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,
},
]
"#]],
);
Expand Down

0 comments on commit 8d3a378

Please sign in to comment.