mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
Only iterate through runnables once
This commit is contained in:
parent
3f8083fc81
commit
9bc005a3bf
1 changed files with 8 additions and 6 deletions
|
@ -567,13 +567,15 @@ mod tests {
|
||||||
let mut runnables = analysis.runnables(position.file_id).unwrap();
|
let mut runnables = analysis.runnables(position.file_id).unwrap();
|
||||||
runnables.sort_by_key(|it| (it.nav.full_range.start(), it.nav.name.clone()));
|
runnables.sort_by_key(|it| (it.nav.full_range.start(), it.nav.name.clone()));
|
||||||
|
|
||||||
let navigation_targets = runnables.iter().map(|a| a.nav.clone()).collect::<Vec<_>>();
|
let mut navigation_targets = Vec::with_capacity(runnables.len());
|
||||||
expect.assert_debug_eq(&navigation_targets);
|
let mut test_kinds = Vec::with_capacity(runnables.len());
|
||||||
|
for runnable in runnables {
|
||||||
|
test_kinds.push(runnable.test_kind());
|
||||||
|
navigation_targets.push(runnable.nav);
|
||||||
|
}
|
||||||
|
|
||||||
assert_eq!(
|
expect.assert_debug_eq(&navigation_targets);
|
||||||
actions,
|
assert_eq!(actions, test_kinds.as_slice());
|
||||||
runnables.into_iter().map(|it| it.test_kind()).collect::<Vec<_>>().as_slice()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_tests(ra_fixture: &str, expect: Expect) {
|
fn check_tests(ra_fixture: &str, expect: Expect) {
|
||||||
|
|
Loading…
Reference in a new issue