Move out completion type position tests

This commit is contained in:
Lukas Wirth 2021-06-21 14:59:49 +02:00
parent f835279b3a
commit b9d85f55b7
5 changed files with 198 additions and 206 deletions

View file

@ -8,6 +8,9 @@ mod item_list;
mod use_tree;
mod items;
mod pattern;
mod type_pos;
use std::mem;
use hir::{PrefixKind, Semantics};
use ide_db::{
@ -46,7 +49,16 @@ pub(crate) fn completion_list(code: &str) -> String {
}
fn completion_list_with_config(config: CompletionConfig, code: &str) -> String {
render_completion_list(get_all_items(config, code))
// filter out all but one builtintype completion for smaller test outputs
let items = get_all_items(config, code);
let mut bt_seen = false;
let items = items
.into_iter()
.filter(|it| {
it.completion_kind != CompletionKind::BuiltinType || !mem::replace(&mut bt_seen, true)
})
.collect();
render_completion_list(items)
}
/// Creates analysis from a multi-file fixture, returns positions marked with $0.